<?php

	include "library.php";

	$cxn = start_code();

    exit_if_search_bot();

    exit_if_session_expired( $cxn );



			/* get variables */

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

	$sqlusername = prep_for_sql( $username );
	
	if ($username == "")
	{
		page_header( "", $cxn );
		
		echo black( "<br>You must enter the username of the advertiser that you wish to view.<br><br><br>" );
		
		echo show_home_link();
	}
	else
	{
		$query = "SELECT * FROM advertiser_profile WHERE username = '".$sqlusername."'";

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

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

			if ($data['deleted'] == 'yes')
			{
				page_header( "", $cxn );
				echo black( "This advertiser account has been deleted" );
			}
			else	/* must happen before print output */
				jump_to_page( "display_advertiser_profile.php", "showid", $data['id'], "returnpoint", "main" );
		}
	}
	
	
    echo "<br><br><br><br><br>";



    echo "</body>";
	
    echo "</html>";

	
?>