<?php

	include "library.php";

	$cxn = start_code();

	$cxn_common = db_common_login();

	
			/* get variables */

	$handle = trim( val( $_POST, "handle" ) );

	$sqlhandle = prep_for_sql( $handle );
	
	if ($handle == "")
	{
		page_header( "", $cxn, $cxn_common );
		
		echo black( "<br>You must enter the handle name of the member who's profile you wish to view.<br><br><br>" );
		
		echo show_home_link();
	}
	else
	{
		$query = "SELECT * FROM profile WHERE handle = '".$sqlhandle."'";

		$result = run_query( $query, $cxn );

		if (query_num_rows($result) == 0)
		{
			page_header( "", $cxn, $cxn_common );
			echo black( "There is no member in the system with this handle" );
		}
		else
		{
			$data = get_row( $result );

			if ($data['locked'] == 'yes')
			{
				page_header( "", $cxn, $cxn_common );
				echo black( "This member's account has been locked" );
			}
			else
			if ($data['deleted'] == 'yes')
			{
				page_header( "", $cxn, $cxn_common );
				echo black( "This member's profile has been deleted" );
			}
			else
			if ($data['visibility'] == 'Hidden')
			{
				page_header( "", $cxn, $cxn_common );
				echo black( "This member's profile is hidden" );
			}
			else	/* must happen before print output */
				jump_to_page( "display_profile.php", "showid", $data['id'], "returnpoint", "main" );
		}
	}
	
?>