<?php

	include "library.php";

	$cxn = start_code();

    exit_if_search_bot();

    exit_if_session_expired( $cxn );



			/* get variables */

	$job_id = trim( val( $_POST, "jobid" ) );

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

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

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

			if ($data['status'] == 'expired')
			{
				page_header( "", $cxn );
				echo black( "This job has expired" );
			}
			else	/* must happen before print output */
				jump_to_page( "display_job.php", "showid", $data['id'], "returnpoint", "main" );
		}
	}
	
	
    echo "<br><br><br><br><br>";



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

	
?>