<?php

	include "library.php";

	$cxn = start_code();

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

		// use different field names to the edit profile screen otherwise going into edit profile will bring values into the search screen
	
	    // if user has entered the minimum and maximum ages the wrong way around
	    
	if (val( $_POST, 'min_age' ) != "" && val( $_POST, 'max_age' ) != "" && val( $_POST, 'max_age' ) < val( $_POST, 'min_age' ))
    {
    	$_SESSION['smin_age'] = val( $_POST, 'max_age' );
	    $_SESSION['smax_age'] = val( $_POST, 'min_age' );
    }	
    else
    {
    	$_SESSION['smin_age'] = val( $_POST, 'min_age' );
	    $_SESSION['smax_age'] = val( $_POST, 'max_age' );
    }
    
	$_SESSION['scity'] = val( $_POST, 'city' );
	$_SESSION['sstate'] = val( $_POST, 'state' );
	$_SESSION['scountry'] = val( $_POST, 'country' );
	$_SESSION['sregion'] = val( $_POST, 'region' );	
	$_SESSION['ssearch_for_word'] = val( $_POST, 'search_for_word' );
	$_SESSION['scompatability'] = val( $_POST, 'compatability' );
	$_SESSION['slogged_on'] = val( $_POST, 'logged_on' );
	$_SESSION['ssex_and_seeking'] = val( $_POST, 'sex_and_seeking' );
	$_SESSION['stick_if_gay'] = val( $_POST, 'tick_if_gay' );


    $ssex_and_seeking = val( $_SESSION, 'ssex_and_seeking' );
	$smin_age = val( $_SESSION, 'smin_age' );
	$smax_age = val( $_SESSION, 'smax_age' );
	$scity = val( $_SESSION, 'scity' );
	$scountry = val( $_SESSION, 'scountry' );
	$sregion = val( $_SESSION, 'sregion' );	
	$ssearch_for_word = val( $_SESSION, 'ssearch_for_word' );
	$scompatability = val( $_SESSION, 'scompatability' );
	$stick_if_gay = val( $_SESSION, 'stick_if_gay' );


	if (val( $_POST, "screen_width" ) != "")
	{
		log_screen_size( $_POST['screen_width'], $_POST['screen_height'], $cxn );

		$_SESSION['screen_height'] = $_POST['screen_height'];
	}


//	if (val( $_POST, "came_from_search" ) == "yes" )
//		log_javascript( val( $_POST, "has_javascript" ), $cxn );

		/* must happen before print output */
		
	jump_to_page( "view_profiles.php", "startpos", "0" );	
	
?>