Location: PHPKode > scripts > WWWebber's Job Search Engine and Aggregator > wwwebber-s-job-search-engine-and-aggregator/library/includes/header.php
<?php

/*
$enable_city_search = 0; // sorry not implemented in free version...requires a database ;)  there are just too many cities 
if(0 != $enable_city_search )
	$defaultCity = 'White Plains'; //default city in miles
else
	$defaultCity ='';
*/

$debug = 0 ;//set to 1 to see debug output
$debugHTML ='';
if( 0 != $debug)
	$debugHTML .='<h1> DEBUG MODE ENABLED</h1>';

$jb = new JobRoll($country);
$jb->debug = $debug;
$jb->setIndeedNumber($my_indeed_publisher_id);
//let script know how to find its own files
$jb->setBaseURL($_SERVER['PHP_SELF']);
$jb->setNumJobsPerPage($number_jobs_per_page);
$jb->setHomePageAnchor($home_page_title);

 $s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
$salt='';
for($i=0; $i<15; $i++){
$r = mt_rand(0,strlen($s)-1);
$salt .= substr($s,$r,1);
}

 
$jb->setSecurityToken($securityPassPhrase);
$jb->setSecuritySalt($salt);




$outputer = new Viewer($country);

$selectBoxes = $outputer->getStatesSelect();

$html ='';	

$html .= '<script type="text/javascript"> var mustUseJob =' . ((0 != $userMustInputJobTitle )? 'true' : 'false') . ';</script>';


$radius  =( (isset($_GET['radius']) && trim($_GET['radius'])!='') ? $jb->cleansGetVars($_GET['radius'])  : $defaultRadius);
$start=( (isset($_GET['start']) && trim($_GET['start'])!='') ? $jb->cleansGetVars($_GET['start'])  : $defaultStart);

//statwide link		teacher/10/usa/ny
//RewriteRule ^/?([A-Za-z0-9_-]+)/([a-zA-Z-_]+)/([a-zA-Z]+)$ index.php?q=$1&co=$2&statewide=$3 [L]
if(isset($_GET['statewide'])   && isset($_GET['co']) && isset($_GET['q'])){

$q3 = $jb->cleansGetVars($_GET['q']) ;
$state =$jb->cleansGetVars($_GET['statewide']);
$jb->goStateWide( $q3 ,$state);
if(0 != $debug)
	$debugHTML .=' mode = statewide  <br />';

}

else 
{
if(isset($_GET['userSearch']) && isset($_GET['sId']) && is_numeric($_GET['sId'])    ){
	$userProvidedToken =urldecode($jb->cleansGetVars($_GET['userSearch']) );
	$substrUserToken = substr($userProvidedToken,0,5);
	$hashThisSide = sha1($userProvidedToken . $jb->getSecuritySalt() .  $substrUserToken) ;
		if(strcmp($jb->getHashData(),$hashThisSide) != 0){
				$error = '<h1>Invalid Data Passed </h1>';
				$error .= 'Possible hacking attempt...or poor use of hashes and salts ';
				die($error); 
			}
 
$q3 = $jb->cleansGetVars($_GET['q']) ;
$loc = $jb->cleansGetVars($_GET['l']);
$state =$jb->cleansGetVars($_GET['state']);

$jb->goUserSearch( $q3 , $loc, $state, $radius, $start ,$userProvidedToken);

 $debugHTML       .= 'mode : User Custom Search <br />';
 $debugHTML       .='User Query ' . $q3 . '<br />';

}	
else{ //mod rewrite;
	$jobQuery = ( (isset($_GET['q']) && trim($_GET['q'])!='') ? $jb->cleansGetVars($_GET['q'])  : $defaultJobQuery );
	$state  =( (isset($_GET['state']) && trim($_GET['state'])!='') ? $jb->cleansGetVars($_GET['state'])  : $defaultState);
	$county  =( (isset($_GET['county']) && trim($_GET['county'])!='') ? $jb->cleansGetVars($_GET['county'])  : $defaultCounty);
	$city  =( (isset($_GET['city']) && trim($_GET['city'])!='') ? $jb->cleansGetVars($_GET['city'])  : $defaultCity);

 
		$jb->go($jobQuery, $state, $county, $radius, $city, $start);
	
	 $debugHTML       .= 'mode : Regular mod_rewrite <br />';
	
	
	}



}

if( strlen(trim($_SERVER['QUERY_STRING']) ) < 1  && $use_custom_home_page_title =='1'){
	//die('a $home_page_custom_title  : ' . $home_page_custom_title); 
	$jb->echoTag('title',$home_page_custom_title ,1);
	}
else if( $use_custom_home_page_title_everywhere == '1'){
	//die('b $home_page_custom_title  : ' . $home_page_custom_title); 
	$jb->echoTag('title',$home_page_custom_title,1 );
	}
else
	$jb->echoTag('title',0);


if( strlen(trim($_SERVER['QUERY_STRING']) ) < 1  && $use_custom_home_H1_tag == '1')
	$html   .=	$jb->echoTag('h1',$home_page_custom_title,1) ;
else if( $use_custom_home_H1_tag_everywhere  == '1' )
	$html   .=	$jb->echoTag('h1', $home_page_custom_title,1) ;
else
	$html   .= $jb->echoTag('h1',0);  //h1


if(strlen($removeFooterSecretCode) > 2)
	$jb->userSecretWord($removeFooterSecretCode);

 
	$html .= $jb->printOut();

if(0 != $debug)
 $html .=  $debugHTML   . $jb->$debugHTML    ;
 
 $html .='<script type="text/javascript"> var country="' . $country. '"</script>';
 
$cssFile=  $jb->getBaseURL(). 'library/css/main.css' ;
$ajaxImageUrl = $jb->getBaseURL() . 'library/images/loader1.gif';
$ajaxImageUrl2 = $jb->getBaseURL() . 'library/images/loader2.gif';
?>
<link href="<?php echo $cssFile;?>" rel="stylesheet" type="text/css">

Return current item: WWWebber's Job Search Engine and Aggregator