<?php
session_start();
require_once('includes/functions.php');
$error=null;
$thisurl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
# check for existance of prior started job ad
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
header('Location: '.BASE_URL.'404.php');
}
# validate id is still in need of previewing
if ($id) {
$select = "SELECT * FROM ".TB_JOBS." WHERE job_id='".clean($id)."' AND preview IS NOT NULL AND completed IS NOT 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);
#validate correct url structure, redirect if wrong
$build_url = BASE_URL . clean_url($row['location']).'/'.clean_url($row['title']).'/'.$row['job_id'].'/';
if ($build_url != $thisurl) {
header('Location: '.$build_url);
}
} else {
$error.= 'That job ID does not exist';
header('Location: '.BASE_URL.'404.php');
}
}
?>
<?php get_template('header', $row['title'] .' - '. $row['category']); ?>
<div id="main">
<div id="jobpreview">
<h2><?php echo $row['title']; ?></h2>
<p class="jobmeta">Posted <?php echo date("F 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>';
} ?>
</p>
<div class="jobbody">
<?php echo nl2br($row['description']); ?>
</div>
<div class="jobapply">
<h4>How to Apply:</h4>
<?php echo nl2br($row['apply']); ?>
</div>
</div>
</div>
<div id="sidebar">
<?php if($row['logo']) {?>
<div class="joblogo">
<a href="<?php echo $row['url']; ?>" target="_blank" ><img src="<?php echo BASE_URL; ?>includes/timthumb.php?src=<?php echo $row['logo']; ?>&w=240&zc=1" alt="<?php echo $row['company']; ?>" /></a>
</div>
<?php } ?>
<!-- AddThis Button BEGIN -->
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&username=xa-4c4f7d093bbaff6f"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4c4f7d093bbaff6f"></script>
<!-- AddThis Button END -->
</div>
<?php get_template('footer'); ?>