| Server IP : 104.21.17.213 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/corbizre/gotofindhomes.com3/ |
Upload File : |
<?php
require_once "lib/dbmysql.class.php";
error_reporting(E_ALL);
$db = new DbMySQL("localhost", "corbizrealestate", "corbizrealestate", "WAotraUcM5M8aA");
if(!$db->connect()){
header('HTTP/1.0 500 Internal Server Error');
exit;
}
//mysqldump -h office.crimeaonline.net -P3307 -pqweqwe123 -u itc hspars| mysql hspars
#$db3 = new DbMySQL("office.crimeaonline.net:3307", "hspars", "itc", "qweqwe123");
#$db3->connect();
$sql = "SELECT count(*) as houses_count FROM houses ORDER BY ID DESC";
$houses_count = $db->select_row($sql);
echo "HOUSES for UPDATE:".$houses_count['houses_count']."\n<br/>";
$processing = 50000;
$iterations_number = ceil($houses_count['houses_count'] / $processing);
echo "HOUSES for UPDATE:".$iterations_number."\n<br/>";
$i=0;
$sitemap_xml = '<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
for ($iteration = 0; $iteration < $iterations_number; $iteration++) {
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'."\n";
$sql = "SELECT ID,DATE_FORMAT(DateUpdated,'%Y-%m-%d') as DateUpdated FROM houses LIMIT ".($iteration * $processing).",".$processing;
//echo "<br/>";
$houses = $db->select($sql);
//echo "HOUSES".$iteration."-".count($houses)."\n";
foreach($houses as $key=>$house){
$xml .= "<url><loc>http://www.corbizrealestate.com/property/".encodeID($house['ID'])."</loc><lastmod>".$house['DateUpdated']."</lastmod></url>\n";
//exit;
}
$xml .= "</urlset>";
$myfile = fopen("/home/corbizrealestate/public_html/sitemap/cbre/sitemap".($iteration+1).".xml", "w") or die("Unable to open file!");
fwrite($myfile, $xml);
fclose($myfile);
echo "/home/corbizrealestate/public_html/sitemap/cbre/sitemap".($iteration+1).".xml\n";
$sitemap_xml .= "<sitemap><loc>http://www.corbizrealestate.com/sitemap/cbre/sitemap".($iteration+1).".xml</loc><lastmod>".$house['DateUpdated']."</lastmod></sitemap>\n";
}
$sitemap_xml .= "</sitemapindex>";
$myfile = fopen("/home/corbizrealestate/public_html/sitemap/cbre/sitemap.xml", "w") or die("Unable to open file!");
fwrite($myfile, $sitemap_xml);
fclose($myfile);
//commercial
$sql_com = "select distinct Zip,City,State from houses where OwnerShip = 2 limit 80000";
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'."\n";
$zip = $db->select($sql_com);
foreach ($zip as $key=>$location ){
$xml .= "<url><loc>http://www.corbizrealestate.com/commercial/".$location['State']."/".str_replace(" ", "-", $location['City'])."/zip-".$location['Zip']."</loc><lastmod>2015-04-13</lastmod></url>\n";
}
$sql_res = "select distinct City,State from houses where OwnerShip = 1 limit 80000";
$city = $db->select($sql_com);
foreach ($city as $key=>$location ){
$xml .= "<url><loc>http://www.corbizrealestate.com/commercial/".$location['State']."/".str_replace(" ", "-", $location['City'])."</loc><lastmod>2015-04-13</lastmod></url>\n";
}
$sql_com = "select distinct State from houses where OwnerShip = 2 limit 80000";
$sql_res = "select distinct State from houses where OwnerShip = 1 limit 80000";
$state = $db->select($sql_com);
foreach ($state as $key=>$location ){
$xml .= "<url><loc>http://www.corbizrealestate.com/commercial/".$location['State']."</loc><lastmod>2015-04-13</lastmod></url>\n";
}
$xml .= "</urlset>";
$myfile = fopen("/home/corbizrealestate/public_html/sitemap/cbre/sitemap-com.xml", "w") or die("Unable to open file!");
fwrite($myfile, $xml);
fclose($myfile);
//residential
$sql_res = "select distinct Zip,City,State from houses where OwnerShip = 1 limit 80000";
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'."\n";
$zip = $db->select($sql_res);
foreach ($zip as $key=>$location ){
$xml .= "<url><loc>http://www.corbizrealestate.com/residential/".$location['State']."/".str_replace(" ", "-", $location['City'])."/zip-".$location['Zip']."</loc><lastmod>2015-04-13</lastmod></url>\n";
}
$xml .= "</urlset>";
$myfile = fopen("/home/corbizrealestate/public_html/sitemap/cbre/sitemap-zip.xml", "w") or die("Unable to open file!");
fwrite($myfile, $xml);
fclose($myfile);
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'."\n";
$sql_res = "select distinct City,State from houses where OwnerShip = 1 limit 80000";
$city = $db->select($sql_res);
foreach ($city as $key=>$location ){
$xml .= "<url><loc>http://www.corbizrealestate.com/residential/".$location['State']."/".str_replace(" ", "-", $location['City'])."</loc><lastmod>2015-04-13</lastmod></url>\n";
}
$xml .= "</urlset>";
$myfile = fopen("/home/corbizrealestate/public_html/sitemap/cbre/sitemap-city.xml", "w") or die("Unable to open file!");
fwrite($myfile, $xml);
fclose($myfile);
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'."\n";
$sql_res = "select distinct State from houses where OwnerShip = 1 limit 80000";
$state = $db->select($sql_res);
foreach ($state as $key=>$location ){
$xml .= "<url><loc>http://www.corbizrealestate.com/residential/".$location['State']."</loc><lastmod>2015-04-13</lastmod><changefreq>daily</changefreq></url>\n";
}
$xml .= "</urlset>";
$myfile = fopen("/home/corbizrealestate/public_html/sitemap/cbre/sitemap-state.xml", "w") or die("Unable to open file!");
fwrite($myfile, $xml);
fclose($myfile);
function encodeID($ID, $CompanyID = null) {
$CompanyID = 9;
$md5 = md5($CompanyID + $ID);
$sum = ord($md5[0]) + ord($md5[5]) * ord($md5[15]) + ord($md5[25]);
$strSum = (string) $sum;
if (strlen($strSum) > 3) {
$strSum = substr($strSum, 0, 3);
} else {
$strSum = str_pad($strSum, 3, '0', STR_PAD_BOTH);
}
$strCompany = (string) $CompanyID;
if (strlen($strCompany) > 4) {
$strCompany = substr($strCompany, 0, 4);
} else {
$strCompany = str_pad($strCompany, 4, '0', STR_PAD_BOTH);
}
return $strCompany . $ID . $strSum;
}