<?php

	include "library.php";

	$cxn = start_code( true );


		/* get parameters */

	$requesting_id = val( $_GET, "requestingid" );

	$conversation_id = val( $_GET, "conversationid" );


		/* check them */

	crash_if_missing( $requesting_id, "requesting_id missing in chat_request", $cxn );

	crash_if_missing( $conversation_id, "conversation_id missing in chat_request", $cxn );

	page_header( "Chat Request", $cxn );

	$query = "SELECT handle, sex FROM profile WHERE id = ".$requesting_id;

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

	$data = get_row( $result );

	$handle = $data['handle'];
	$sex = $data['sex'];
	
	echo red( "You have received a chat request from member ".$handle."<br><br>" );

	if ($sex == "Male")
	{
		echo red( "To respond to this request please go to his profile by clicking the link below.<br><br>" );
		echo red( "If you would like to chat with him please click the 'Accept Chat' button on his profile.<br><br>" );
	}
	else
	{
		echo red( "To respond to this request please go to her profile by clicking the link below.<br><br>" );
		echo red( "If you would like to chat with her please click the 'Accept Chat' button on her profile.<br><br>" );
	}

	echo show_link( "View Profile", "display_profile.php", "showid", $requesting_id, "returnpoint", "main", "conversationid", $conversation_id );

?>


