<?php

	include "library.php";

	$cxn = start_code();

			/* get variables */

	$id = val( $_SESSION, "id" );

	$reply_to_id = val( $_GET, "replytoid" );

	
	page_header( "Reply to kiss", $cxn );

		/* check parameters */

	crash_if_missing( $id, "id missing in reply to kiss form", $cxn );

	crash_if_missing( $reply_to_id, "reply to id missing in reply to kiss form", $cxn );


	form_start( "reply_to_kiss_go.php", "replytoid", $reply_to_id );

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

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

	$data = get_row( $result );

	if (mysql_num_rows($result) == 0)
		crash( "Internal error in reply-to-kiss", $cxn );

	if ($data['sex'] == "Male")
	{
		$msg1 = $data['handle']." thanks you for your kiss. He is interested in hearing from you and looks forward to your email";
		$msg2 = $data['handle']." thanks you for your kiss. He appreciates your thought but would not like to correspond further";
		$msg3 = $data['handle']." thanks you for your kiss. He has recently started seeing somone else and so is not responding at this time";
	}
	else
	if ($data['sex'] == "Female")
	{
		$msg1 = $data['handle']." thanks you for your kiss. She is interested in hearing from you and looks forward to your email";
		$msg2 = $data['handle']." thanks you for your kiss. She appreciates your thought but would not like to correspond further";
		$msg3 = $data['handle']." thanks you for your kiss. She has recently started seeing somone else and so is not responding at this time";
	}
	else
		crash( "Internal Error: invalid sex in kiss reply", $cxn );

	form_radio( "", "reply",  "1", $msg1, "" );
	form_radio( "", "reply",  "2", $msg2, "" );
	form_radio( "", "reply",  "3", $msg3, "" );

	form_submit( "send_reply" );

	form_end();

?>
