include("top.php");
$time=time();
if($form=='complete'){
if($category!='All Categories' && $category!=''){$s_category=" && category1='$category'";}
if($zip!=''){
$zip=str_replace(" ", "", $zip);
$zip=strtoupper($zip);
$zip_length=strlen($zip);
if($zip_length>=6){$zip=substr($zip, 0, 3)." ".substr($zip, 3);}
$pos1=strpos("$zip", '00');
$pos2=strpos("$zip", '0');
if($pos1 === false){}
elseif($pos1!== false){if($pos1==0){$zip=substr($zip, 1);}}
if($pos2=== false){}
elseif($pos2!== false){if($pos2==0){$zip=substr($zip, 1);}}
if($distance!='within any distance'){
$zip_coordinates=mysql_query("SELECT lattitude, longitude FROM zip_code WHERE zip_code='$zip'");
$zip_coordinates=mysql_fetch_assoc($zip_coordinates);
$lat_up=($distance/100)+$zip_coordinates[lattitude];
$lat_down=$zip_coordinates[lattitude]-($distance/100);
$long_up=($distance/100)+$zip_coordinates[longitude];
$long_down=$zip_coordinates[longitude]-($distance/100);
$zip_variable="&& latitude<$lat_up && latitude>$lat_down && longitude<$long_up && longitude>$long_down";
}
}
else{
if(!$country){$s_country="";}
elseif($country!='All Countries'){$s_country=" && country='$country'";}
if(!$province){$s_province="";}
elseif($province!='All'){$s_province=" && province='$province'";}
if($city!=''){$s_city=" && city='$city'";}
}
if($keyword!=''){
$s_keyword1=", MATCH(job_title, description, tagline) AGAINST('$keyword') as relevance";
$s_keyword2=" && MATCH(job_title, description, tagline) AGAINST('$keyword')>0.3";
$s_keyword3="relevance DESC, ";
}
$page_variable="category=$category&country=$country&province=$province&city=$city&metro=$metro&distance=$distance&form=complete&keyword=$keyword&zip=$zip";
if(!$page){$page=1;}
$sql="SELECT jobs.ad FROM jobs, featured_jobs WHERE jobs.ad=featured_jobs.ad && featured_jobs.featured_source_id='3' && jobs.ad=featured_jobs.ad && jobs.primary_id='0'".$s_category.$s_country.$s_province.$s_city.$s_keyword2." GROUP BY jobs.ad";
$search_query=mysql_query($sql);
$total_jobs=mysql_num_rows($search_query);
mysql_free_result($search_query);
if($page<=1){$page=1;}
$sql="SELECT jobs.ad, featured_jobs.hp_job_title, jobs.job_title, jobs.city, jobs.province".$s_keyword1." FROM jobs, featured_jobs WHERE jobs.ad=featured_jobs.ad && featured_jobs.featured_source_id='3' && jobs.ad=featured_jobs.ad && jobs.primary_id='0'".$s_category.$s_country.$s_province.$s_city.$s_keyword2." GROUP BY jobs.ad ORDER BY ".$s_keyword3."created DESC LIMIT ".($page*25-25).", 25";
$search_query=mysql_query($sql);
$max_pages=round(($total_jobs/25)+.49, 0);
$first=($page*25)-24;
$last=($page*25);
if($total_jobs<$last){$last=$total_jobs;}
$first1=$first-1;
if($total_jobs>0){
print("
$first - $last of $total_jobs jobs that match your search criteria
|
");
$loop=2;
if($page>=6){$page1=$page-5; print("First ");}else{$page1=1;}
print("$prev$page1 ");
$loop=1;
while($loop<10 && $page1<$max_pages){
$page1=$page1+1;
print("$page1 ");
$loop++;
}
print("$next |
|
");
while($s4=mysql_fetch_assoc($search_query)){
if($s4[hp_job_title]!==null && $s4[hp_job_title]!==''){$s4[job_title]=$s4[hp_job_title];}
else{$s4[job_title]=substr($s4[job_title], 0, strrpos($s4[job_title], $s4[city]));}
print("
".$s4[job_title]." |
".ucwords(strtolower($s4[city])).", $s4[province] |
");
}
mysql_free_result($search_query);
print("
You are currently viewing page $page of $max_pages | ");
$loop=0;
if($page>=6){$page1=$page-7; print("First ");}else{$page1=0;}
print("$prev");
while($loop<10 && $page1<$max_pages){
$page1=$page1+1;
if($page1>0){
print("$page1 ");
$loop++;
}
}
print("$next |
|
");
}
else{
print("
No Job Listings
|
There are currently no job listings that match your criteria.
Click Here to try another search.
|
");
}
mysql_free_result($search_query);
}
else{
print("");
print("");
if($location_ca=='selected'){$zip_postal="Postal/Zip";}
else{$zip_postal="Zip/Postal";}
print(" | |
");
}
include("bottom.php");
?>