<?php

	include "library.php";

	$cxn = start_code();

	
			/* get variables */

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

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

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

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

			if ($data['locked'] == 'yes')
			{
				page_header( "", $cxn );
				echo black( "This member's account has been locked" );
			}
			else
			if ($data['deleted'] == 'yes')
			{
				page_header( "", $cxn );
				echo black( "This member's profile has been deleted" );
			}
			else
			if ($data['visibility'] == 'Hidden')
			{
				page_header( "", $cxn );
				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" );
		}
	}
?>

