"Storage Units in $stup", "AutoTransport" => "Auto Transport in $stup", "Moving" => "Moving Companies in $stup" ); $res = @mysql_query("select * from YellowPages where State = '$mystate' && Category like '%Moving' && Business_Name != 'U-haul Co.' ORDER BY RAND() limit 15"); //$cont = "

$haeders[$v]

"; $cont = ""; while ($row = mysql_fetch_array($res)){ $cont .= ""; $cont .= ""; $cont .= ""; } return $cont."
NameCityAddress
$row[Business_Name]$row[City]$row[Full_Address]
"; } function get_county($county,$state,$v){ connect(); $stc = @mysql_query("SELECT DISTINCT `City` FROM `ZipCodesData` WHERE County = '$county' AND State = '$state'"); $sql = ''; while ($r = mysql_fetch_array($stc)){ $sql .= "City='".ucwords(strtolower($r[City]))."' or "; } $sql = substr($sql,0,-4); $res = @mysql_query("select * from YellowPages where State = '$state' && ($sql) && Business_Name != 'U-haul Co.' ORDER BY RAND() limit 15"); global $state_full_rev; $stup = ucwords(strtolower($county)) ." County, $state_full_rev[$state]"; $rescnty = @mysql_numrows($res); if ($rescnty < 15){ $clim = 15 - $rescnty; $res2 = mysql_query("select * from YellowPages where State = '$state' && Category like '%Moving' && Business_Name != 'U-haul Co.' ORDER BY RAND() limit $clim"); } $haeders = array( "Storage" => "Storage Units in $stup", "AutoTransport" => "Auto Transport in $stup", "Moving" => "Moving Companies in $stup" ); $i=1; $cont .= "

$haeders[$v]

"; $cont .= ""; while ($row = mysql_fetch_array($res)){ $cont .= ""; $cont .= ""; $cont .= ""; $i++; } if ($res2) while ($row = mysql_fetch_array($res2)){ $cont .= ""; $cont .= ""; $cont .= ""; $i++; } return $cont."
NameCityAddress
$row[Business_Name]$row[City]$row[Full_Address]
$row[Business_Name]$row[City]$row[Full_Address]
"; } function get_city($city,$state){ connect(); $res = @mysql_query("select * from YellowPages where State = '$state' && City = '$city' && Business_Name != 'U-haul Co.' ORDER BY RAND() limit 15"); $cityres = @mysql_numrows($res); if ($cityres < 15){ $lim = 15 - $cityres; $cn = @mysql_query("select County from ZipCodesData where State = '$state' && City = '$city' limit $lim"); $cnt = mysql_fetch_array($cn); $county = $cnt[County]; $stc = @mysql_query("SELECT DISTINCT `City` FROM `ZipCodesData` WHERE County = '$county' AND State = '$state'"); $sql = ''; while ($r = mysql_fetch_array($stc)){ $sql .= "City='".ucwords(strtolower($r[City]))."' or "; } $sql = substr($sql,0,-4); $res2 = @mysql_query("select * from YellowPages where State = '$state' && ($sql) && Business_Name != 'U-haul Co.' ORDER BY RAND() limit $lim"); global $state_full_rev; $stup = ucwords(strtolower($county)) ." County, $state_full_rev[$state]"; $cnyres = @mysql_numrows($res2); if ($cnyres < $lim){ $slim = 15 - $cnyres; $res3 = @mysql_query("select * from YellowPages where State = '$state' && Business_Name != 'U-haul Co.' ORDER BY RAND() limit $slim"); global $state_full_rev; $stup = $state_full_rev[$state]; } } else{ $stup = "$city, $state"; } $haeders = array( "Storage" => "Storage Units in $stup", "AutoTransport" => "Auto Transport in $stup", "Moving" => "Moving Companies in $city, $state" ); $cont .= "

$haeders[Moving]

"; $cont = ""; while ($row = mysql_fetch_array($res)){ $cont .= ""; $cont .= ""; $cont .= ""; } if ($res2) while ($row = mysql_fetch_array($res2)){ $cont .= ""; $cont .= ""; $cont .= ""; } if ($res3) while ($row = mysql_fetch_array($res3)){ $cont .= ""; $cont .= ""; $cont .= ""; } return $cont."
NameCityAddress
$row[Business_Name]$row[City]$row[Full_Address]
$row[Business_Name]$row[City]$row[Full_Address]
$row[Business_Name]$row[City]$row[Full_Address]
"; } function print_states(){ global $states_full; $cont = "

"; foreach ($states_full as $k => $v){ $cont .= "".ucwords(str_replace('_',' ',$k))."   "; } return $cont."

"; } function print_counties($state){ $ustate = ucwords(str_replace("_"," ",$state)); $state = str_replace(" ","_",$ustate); global ${$state}; $counies = ${$state}; $cont = "

"; foreach ($counies as $k){ $ku = add_und($k); $cont .= "$k | "; } $head = "

 

"; $head .= "

$ustate Counties

"; $cont = $head.$cont."

"; return $cont; } function print_county_cities($county,$state){ global $states_full; $st = $states_full[$state]; $ustate = ucwords(str_replace("_"," ",$state)); $state = str_replace(" ","_",$ustate); $stc = mysql_query("SELECT DISTINCT `City` FROM `ZipCodesData` WHERE County = '$county' AND State = '$st'") or die(mysql_error()); $cont = ''; while ($r = mysql_fetch_array($stc)){ $ucity = ucwords(str_replace("_"," ",strtolower($r[City]))); $rcity = str_replace(" ","_",$ucity); $cont .= "$rcity | "; } $head = "

 

"; $head .= "

$county County Cities

"; $cont = $head.$cont."

"; return $cont; } function print_cities($state,$f=2){ $ostate = $state; $ustate = ucwords(str_replace("_"," ",$state)); $state = str_replace(" ","_",$ustate); global ${"Major_Cities_in_".$state}, $states_full; $st = $states_full[$ostate]; $cities = ${"Major_Cities_in_".$state}; $cont = "

"; foreach ($cities as $k){ $cnt = mysql_query("SELECT County FROM ZipCodesData WHERE City = '$k' AND State = '$st' LIMIT 1") or die(mysql_error()); $r = mysql_fetch_row($cnt); $ku = add_und($k); if ($f==2) $cont .= "$k | "; else $cont .= "$k | "; } $head = "

 

"; $head .= "

Major Cities in $ustate

"; $cont = $head.$cont."

"; return $cont; } function print_major_cities(){ global $maj_cities_by_size, $states_full; $cont = "
Major Cities By Size"; $ste = array_flip($states_full); foreach ($maj_cities_by_size as $k){ $ct = rem_und($k[0]); $st = $k[1]; $cnt = mysql_query("SELECT County FROM ZipCodesData WHERE City = '$k[0]' AND State = '$k[1]'") or die(mysql_error()); $r = mysql_fetch_row($cnt); $cont .= "$k[0] | "; } return $cont."
"; } function add_und($k){ return str_replace(" ","_",$k); } function rem_und($k){ return str_replace("_"," ",$k); } ###### // start printing the page // include "data.php"; connect(); $city = mysql_real_escape_string($_GET[city]); $county = mysql_real_escape_string($_GET[county]); $city = rem_und($city); $county = rem_und($county); $upstate = ucwords(str_replace("_"," ",$state)); $instate = $states_full[$state]; include "local_data.php"; $cats = array("Storage","AutoTransport","Moving"); require "/home/wis4565/public_html/smarty/libs/Smarty.class.php"; $path = "/home/wis4565/public_html/smarty/"; $smarty = new Smarty; $smarty->template_dir = $path.'templates/'; $smarty->compile_dir = $path.'templates_c/'; $smarty->cache_dir = $path.'cache/'; $my_cache_id = $state.'-'.$county.'-'.$city; $smarty->caching = true; //true; //false; $smarty->cache_lifetime = 3600*24*180; if (!$smarty->is_cached('index.tpl', $my_cache_id)){ if (!$state){ //$content .= file_get_contents('/home/wis4565/public_html/smarty/');; $content .= print_states(); $content .= "

 

"; $smarty->assign('area','your area'); $marker = 1; //$content .= print_major_cities(); } else if (!$county && !$city){ //$content .= "

Moving Services > "; $content .= "$upstate movers

"; shuffle($cats); $file = $path.'states/'.str_replace('_','',$state).'.txt'; shuffle($state_h1); $content .= "

$state_h1[0]

"; $content .= file_get_contents($file); $content .= "

Get a free quote from $upstate top moving companies

"; $state = strtolower($state); $content .= get_state($state,'Moving'); $content .= print_counties($state); $content .= print_cities($state,'3'); $smarty->assign('area',$upstate); $marker = 2; } else if (!$city){ shuffle($county_h1); shuffle($county_body); $ostate = $state; //$content .= "

Local Movers > "; $content .= "$upstate movers > "; $content .= "$county county, $upstate movers

"; $content .= "

$county_h1[0]

"; $content .= $county_body[0]; $smarty->assign('area',$county.' county, '.$instate); shuffle($cats); $state = strtolower($state); $state = $states_full[$state]; $content .= get_county($county,$state,'Moving'); $content .= print_county_cities($county,$ostate); $content .= print_cities($ostate); $marker = 3; } else if ($city){ shuffle($city_h1); shuffle($city_body); //$content .= "

Local Movers > "; $content .= "$upstate movers > "; //$content .= "$county county > "; $content .= "$city, $instate moving companies

"; $content .= "

$city_h1[0]

"; $content .= $city_body[0]; shuffle($cats); $state = strtolower($state); $state = $states_full[$state]; $content .= get_city($city,$state); $smarty->assign('area',$city.', '.$instate); } else{ $content .= "\n"; } $city != '' ? $city = $city : $city = $county . " County"; ##### Meta tags & ######### if ($marker == 1){ $keywords = "moving companies, movers, directory, truck rental, storage, state, city"; $description = "Find moving companies, movers, truck rental services and storage anywhere in the US. We can help you locate a moving company in any city in the states"; $title = "Online movers, moving companies, truck rental services and storage directory"; } else if ($marker == 2){ $keywords = "$upstate, $instate, $upstate Moving companies, moving company, Movers, moving companies, truck rental, relocation, shipping, car transport, storage"; $description = "Find moving companies in $upstate, get free quotes from movers and choose the right moving company for your needs. $upstate car transport, truck rental and storage estimates"; $title = "Moving Companies, truck rental and movers in $upstate"; } else if ($marker == 3){ $m = array("Moving companies", "Movers", "moving company"); $s = array("truck rental", "car transport", "storage", "shipping", "relocation"); shuffle($m); shuffle($s); $keywords = "$city $instate, $m[0], $m[1], $m[2], $upstate $s[0], $s[1], $s[2], $s[3], $s[4]"; $description = "Find moving companies in $county County $upstate, get free quotes from movers and choose the right moving company for your needs. $county $instate car transport, truck rental and storage estimates"; $title = "Moving Companies, truck rental and movers in $county $instate, $upstate"; } else { ######## Set Keywords ############# $m = array("movers", "Moving companies", "Mover"); $s = array("moving company", "truck rental", "car transport", "storage"); shuffle($m); shuffle($s); $keywords = "$city $instate, $m[0], $m[1], $m[2], $upstate $s[0], $s[1], $s[2], $s[3]"; ######## Set Description ############# $d = array( 0 => "Movers in $city $upstate are standing by to give you a free quote. Compare moving companies in $city $instate; find local car moving services, truck rent and storage. Choose the right moving company for your needs", 1 => "Find moving companies in $city $upstate, movers and truck rental services. Compare different $city movers, locate a moving company and get free quotes in our mover directory. We can help you save time and money by getting you a free quote in 2 clicks", 2 => "$city $upstate movers, moving companies and truck rental agencies. Here you can get a free quote, compare $city $instate movers and save on your move. We have the largest database of moving companies in $upstate" ); shuffle($d); $description = $d[0]; ######## Set Title ############# $t = array( 0 => "$city $upstate Movers, $instate Moving Companies, Truck Rental - Free Mover Estimate", 1 => "$city $instate Moving Companies, $city Movers, Free Quotes, Truck Rental Directory", 2 => "$city Movers, $upstate Moving Companies, $instate Moving Company - Free Quote" ); shuffle($t); $title = $t[0]; } ######## Set Footter Links ############# YET TO BE SET $state = $_GET[state]; include "included_links.php"; if(array_key_exists($state,$altlinks)){ $link_1 = "".$altlinks[$state]['link_1'][1].""; $link_2 = "".$altlinks[$state]['link_2'][1].""; } else { $link_1 = "Moving Companies"; $link_2 = "Movers Packers";; } $root == 'movingcompanies' ? $formrtitle = "Movers" : $formrtitle = "Moving Companies"; $smarty->assign('title',$title); $smarty->assign('keywords',$keywords); $smarty->assign('description',$description); $smarty->assign('formrtitle', $formrtitle); $smarty->assign('content', $content); $smarty->assign('link_1',$link_1); $smarty->assign('link_2',$link_2); } // end smarty not cached ////////* Smarty thing */////////// $smarty->display('index.tpl',$my_cache_id); //$smarty->display('index.tpl'); ?>