$root = 'movers';
$state = 'west_virginia';
function connect(){
$db_host = "localhost";
$db_name = "tv411ne_subich";
$db_username = "tv411ne_tv411n";
$db_password = "}TbL;m+RyA4z";
$link = mysql_connect($db_host, $db_username, $db_password);
mysql_select_db($db_name);
}
function get_state($state,$v){
if (strlen($state) < 3){
$mystate = $state;
$stup = ucwords(str_replace('_',' ',$state));
}
else{
global $states_full;
$mystate = $states_full[$state];
$stup = ucwords(str_replace('_',' ',$state));
}
$haeders = array(
"Storage" => "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 = "
Name
City
Address
";
while ($row = mysql_fetch_array($res)){
$cont .= "
$row[Business_Name]
";
$cont .= "
$row[City]
";
$cont .= "
$row[Full_Address]
";
}
return $cont."
";
}
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 .= "
Name
City
Address
";
while ($row = mysql_fetch_array($res)){
$cont .= "
$row[Business_Name]
";
$cont .= "
$row[City]
";
$cont .= "
$row[Full_Address]
";
$i++;
}
if ($res2)
while ($row = mysql_fetch_array($res2)){
$cont .= "
$row[Business_Name]
";
$cont .= "
$row[City]
";
$cont .= "
$row[Full_Address]
";
$i++;
}
return $cont."
";
}
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 = "
Name
City
Address
";
while ($row = mysql_fetch_array($res)){
$cont .= "
$row[Business_Name]
";
$cont .= "
$row[City]
";
$cont .= "
$row[Full_Address]
";
}
if ($res2)
while ($row = mysql_fetch_array($res2)){
$cont .= "
$row[Business_Name]
";
$cont .= "
$row[City]
";
$cont .= "
$row[Full_Address]
";
}
if ($res3)
while ($row = mysql_fetch_array($res3)){
$cont .= "
$row[Business_Name]
";
$cont .= "
$row[City]
";
$cont .= "
$row[Full_Address]
";
}
return $cont."
";
}
function print_states(){
global $states_full;
$cont = "
";
$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');
?>