<?php

	include "library.php";

	$cxn = start_code();

    exit_if_search_bot();

    exit_if_session_expired( $cxn );


//      Monitor execution time and memory usage
//	include "/home/academicdating/public_html/ubench/Ubench.php";
//	$bench = new Ubench;
//  $bench->start();


	$today_date = date_create( date( "Y-m-d H:i:s" ) );


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


	
		/* if the user is not logged in them direct them to the login page then back to here */

	if ($advertiser_id == "")
	{
		$_SESSION['nextpage'] = url_encode( "list_jobs.php" );

	    jump_to_page( "advertiser_login.php" );		/* must happen before print output */

		exit();
	}

	$date_today = date( "Y-m-d H:i:s" );


	$query = "SELECT * FROM job WHERE advertiser_id = ".$advertiser_id;

	$query .= " ORDER BY id DESC";


	page_header( "Jobs List", $cxn );			
	
	

		/* run the query */

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

    echo "<table>";
    
	for ($i=0; $i < query_num_rows($result); $i++)
	{
		$data = get_row( $result );

		echo "<a name='id".$data['id']."'>";		/* bookmark to go back to search screen */

        echo "<tr><td></td>";

        echo "<td>Job ID: ".$data['id']."</td>";

        echo "<td>Type: ".name_case( $data['type'] )."</td>";

        echo "<td>".show_link( $data['short_description'], "edit_job.php", "jobid", $data['id'], "newjob", "false" )."</td>";

        echo "<td>City: ".$data['city']."</td>";

        echo "<td>Postcode: ".$data['postcode']."</td>";

        echo "</tr>";
        
        echo "<tr><td></td><td colspan='6'><hr></td></tr>";
	}

    echo "</table>";

//    if (! low_res_screen())
//        echo "</td><td width='5%'>&nbsp;</td><tr></table>";


	echo "<br><br><br><br><br><br><br>";
	

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


?>