Location: PHPKode > projects > JobAppr > Jobappr-1.4/preview.php

# check for existance of prior started job ad
if (isset($_SESSION['job_ad_id_for_job_board'])) {
	$id = $_SESSION['job_ad_id_for_job_board'];
} else {
	$error .= 'A job ID is required - Check #1 ';
	header('Location: post.php?invalid');

# validate id is still in need of previewing
if ($id) {
	$select = "SELECT * FROM ".TB_JOBS." WHERE form_id='".clean($id)."' AND preview IS NULL AND completed IS NULL";
	$result = mysql_query($select);
	$count = mysql_num_rows($result);
	# if the sql returned an unfinished job ad with the id given, pull that data
	if($count == 1) {
		$row = mysql_fetch_assoc($result);
	} else {
		$error .= 'That job ID does not exist - Check #2 ';
		header('Location: post.php');
} else {
	$error.= 'A job ID is required - Check #3 ';
	header('Location: post.php');

# when someone pushes the button to approve their job ad
if (isset($_POST['submit'])) {
	# update database to replace preview with timestamp, then redirect to purchase page
	mysql_query("UPDATE ". TB_JOBS ."	SET preview='".clean(date("D M j G:i:s T Y"))."'WHERE form_id='".$id."'");
	header('Location: purchase.php');

<?php get_template('header', 'Preview Your Ad'); ?>

	<div id="main">

		<h3><span>Step 2:</span> Preview Your Ad</h3>
		<div id="jobpreview">
			<h2><?php echo $row['title']; ?></h2>
			<p class="jobmeta">Posted <?php echo date("M d, Y", convert_datetime($row['created'])); ?></p>
			<p class="jobhead"><strong><?php echo $row['company']; ?></strong><br />
				Location: <?php echo $row['location']; ?><br />
				<?php if (! empty($row['url'])) {
					echo '<a href="'.$row['url'].'" target="_blank" >'.$row['url'].'</a>';
				} ?>
			<div class="jobbody">
				<?php echo nl2br($row['description']); ?>
			<div class="jobapply">
				<h4>How to Apply:</h4>
				<?php echo nl2br($row['apply']); ?>
		<form action="<?php echo get_filename(); ?>" method="post" enctype="multipart/form-data" >
			<p class="submitline"><span><input type="submit" class="submit" name="submit" id="submit" value="Continue to Step 3 &mdash; Make your purchase" /></span></p>
	<div id="sidebar">
		<?php if($row['logo']) {?>
		<div class="joblogo">
			<a href="<?php echo $row['url']; ?>" target="_blank" ><img src="includes/timthumb.php?src=<?php echo $row['logo']; ?>&w=240&zc=1" alt="<?php echo $row['company']; ?>" /></a>
		<?php } ?>
		<div class="inner">
			This is the way your job ad will look once it is posted.</p><p>Want to make changes to it? Go back and <a href="post.php">edit your ad</a>.

<?php get_template('footer'); ?>
Return current item: JobAppr