'; echo "\r\n"; echo''; echo "\r\n"; /* |-------------------------------------------------------------------------- | Custom Function: sitemap.php?page=1&load=1 | Extract and save data to option table |* @param page = x (to run multiple pages) load = 1 (to write to robots.txt) |* @return (true, false) |-------------------------------------------------------------------------- | */ include_once("includes/config.php"); $mysqli = new mysqli($hostname, $username, $password, $database); if (isset($_GET['specialtyID'])) $specialtyID = $_GET["specialtyID"]; else $specialtyID = ''; if (isset($_GET["page"])) $page = $_GET["page"]; else $page = ''; if (isset($_GET["load"])) $load = $_GET["load"]; else $load = ''; $startpost = "47"; $per_page =5000;//define how links per page $base_url="https://".$_SERVER['SERVER_NAME'].dirname($_SERVER["REQUEST_URI"].'?'); //echo "base url: $base_url
"; ?> https:/// daily 1.0 $item) { ?> https:// daily 0.9 https:/// daily 0.8 $item) { if ($item == "law-office") $sql = "SELECT CONCAT('/$item/',URLSTATE,'/') as link FROM states"; else $sql = "SELECT CONCAT('/$item/location/',URLSTATE,'/') as link FROM states"; //ex: https://www.lawyersattorneysguide.com/law-office/florida/ //ex: https://www.lawyersattorneysguide.com/immigration-law/location/florida/ $oRs = $mysqli->query($sql); while($string=$oRs->fetch_array()){?> https:// daily 0.7 0) { $start = ($page - 1) * $per_page; include_once("_custom-header.php"); if ($specialtyID == "8111") { $sql = "SELECT DISTINCT CONCAT('/$specialtyDir/', REPLACE(LOWER(b1.URLSTATE),' ','-'), '/',REPLACE(LOWER(a1.CITY),' ','-'),'/') as link FROM $tablelist a1 LEFT JOIN states b1 ON b1.STCODE = a1.STATE WHERE a1.CITY IS NOT NULL AND a1.`SIC CODE` = $specialtyID LIMIT $start,$per_page "; } else { $sql = "SELECT DISTINCT CONCAT('/$specialtyDir/location/', REPLACE(LOWER(b1.URLSTATE),' ','-'), '/',REPLACE(LOWER(a1.CITY),' ','-'),'/') as link FROM $tablelist a1 LEFT JOIN states b1 ON b1.STCODE = a1.STATE WHERE a1.CITY IS NOT NULL AND a1.`SIC CODE` = $specialtyID LIMIT $start,$per_page "; } $oRs = $mysqli->query($sql); //echo $sql; while($string=$oRs->fetch_array()){?> https://www.lawyersattorneysguide.com daily 0.7
0) { $sql = $mysqli->query("select count(*) as total FROM wp_posts WHERE post_title <> '' AND ID > ".$startpost." "); //$string = $sql->fetch_assoc(); $string = mysqli_fetch_array($sql); $tot_rows = $string['total']; $total = ceil($tot_rows/$per_page); echo "Pages: ".$total."
"; $txtrobots = "# robots.txt\r\n"; $txtrobots .= "User-agent: Googlebot\r\n"; $txtrobots .= "User-agent: Slurp\r\n"; $txtrobots .= "User-agent: msnbot \r\n"; $txtrobots .= "User-agent: Mediapartners-Google*\r\n"; $txtrobots .= "User-agent: Mediapartners-Google\r\n"; $txtrobots .= "User-agent: Googlebot-Image \r\n"; $txtrobots .= "User-agent: Yahoo-MMCrawler\r\n"; $txtrobots .= "User-agent: Adsbot-Google\r\n"; $txtrobots .= "User-agent: *Google*\r\n"; $txtrobots .= "Disallow: \r\n"; $txtrobots .= "\r\n"; $txtrobots .= "User-agent: SemrushBot\r\n"; $txtrobots .= "Disallow: /\r\n"; $txtrobots .= "\r\n"; $txtrobots .= "User-agent: SemrushBot-SA\r\n"; $txtrobots .= "Disallow: /\r\n"; $txtrobots .= "\r\n"; for ($i = 1; $i <= $total; $i++) { $txtrobots .= "Sitemap: https://". $_SERVER["SERVER_NAME"]. "/sitemap.php?page=".$i."\r\n"; } echo $txtrobots; $fp = fopen("robots.txt", 'w'); fwrite($fp, $txtrobots); fclose($fp); echo "Done!"; } ?>