http://$domain/$file $dates $freq $priority "; } $cdate = time(); // add password...force if empty if (!$password && !$_POST["pass"]){ echo 'Leaving the password blank is not an option

'; echo 'What would you like your password to be :
'; echo '
'; exit; } elseif (!$password && $_POST["pass"]){ $epass = md5(htmlspecialchars($_POST["pass"])); echo 'Please enter '.$epass.' in the place provided in line 27. This is the md5 encryption for the password of your choice nd upload this script again. '.htmlspecialchars($_POST["pass"]).''; exit; } // print out sitemap if no login if (file_exists($cmap)) { $exdate = $cdate-date(filemtime($cmap)); } if (!$_GET["login"] && file_exists($cmap)){ $cfile = fopen($cmap, 'r'); $themap = fread($cfile, filesize($cmap)); fclose($cfile); if ($exdate<$cache_time){ header("Content-Type: text/xml;charset=iso-8859-1"); echo $themap; exit; } // if file does not exist } elseif (!$_GET["login"] && !file_exists($cmap) && !file_exists($rid)){ echo 'Parameters not set, Please Login'; exit; } //get session pw if exists if ($_GET["login"] && md5($_POST["pword"])<>$password && $_SESSION['pw'] ){ $_POST["pword"] = $_SESSION['pw']; } // if login pw is empty or incorrect if ($_GET["login"] && md5($_POST["pword"])<>$password){ echo "
Please enter your password for access
"; echo "

"; exit; } $_SESSION['pw'] = $_POST["pword"]; if ( $_POST["fofi"]){ $avoid = implode(' ', $_POST["fofi"]); // get post data for files to be avoided. } if (($_POST["finished"] || $exdate>($cache_time-1)) || (file_exists($rid) && !file_exists($cmap))){ // $domain = $_SERVER['HTTP_HOST']; $domain = $webdomain; // get cached avoid values from file if (!$_POST["fofi"] && filesize($rid)>0 ) { $rfile = fopen($rid, 'r'); $avoid = fread($rfile, filesize($rid)); fclose($rfile); } // output xml for export etc ob_start(); echo ' '; // go through root and included folders if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($file) && !preg_match("/\b$file\b/i", $avoid )) { //dir $dc.=' '.$file; // folder get the files $dir =$file; $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if(eregi($accept, $file) && !preg_match("/\b$file\b/i", $avoid)) { //if this file is a valid file out_xml($file, $dir, $domain, $priority, $freq, $dates); }} closedir($dh); unset($dir); } elseif(eregi($accept, $file) && !preg_match("/\b$file\b/i", $avoid)) { //if this file is a valid file out_xml($file, $dir, $domain, $priority, $freq, $dates); }}} closedir($handle); } echo ' '; $new_map = ob_get_contents(); ob_end_clean(); // output cache to file $fi = fopen($cmap, 'w') or die("Can't open file"); fwrite($fi, $new_map); fclose($fi); if ($themap<> $new_map) { // send email if email address setup if ($email) { mail($email, $_SERVER['HTTP_HOST'].' Sitemap changed', "sitemap.php has updated and now includes $lc Pages in your sitemap"); } // ping google if sitemap changed if( $frep=@fsockopen('www.google.com', 80) ) { $request = 'GET /webmasters/tools/ping?sitemap=' . urlencode( $url ) . " HTTP/1.1\r\n" . "Host: www.google.com\r\n" . "User-Agent: Mozilla/5.0 (compatible; " . PHP_OS . ") PHP/" . PHP_VERSION . "\r\n" . "Connection: Close\r\n\r\n"; fwrite( $frep, $request ); fclose( $frep ); }} if (!$_POST["finished"]){ // if sitemap was deleted, but avoid.php exists header("Content-Type: text/xml;charset=iso-8859-1"); echo $new_map; exit; } // output files/dirs to be avoided to file if ($_POST["finished"]){ $fi = fopen($rid, 'w') or die("Can't open file"); fwrite($fi, $avoid); fclose($fi); echo "Google Sitemap complete!! with a total of $lc Links

Click here to view New Sitemap"; session_destroy(); exit; } elseif ($exdate>($cache_time-1)) { header("Content-Type: text/xml;charset=iso-8859-1"); echo $new_map; } // end of sitemap output } else { if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if (is_dir($file)) { //dir $dc.=' '.$file; } elseif(eregi($accept, $file)) { //if this file is a valid file $fc.=' '.$file; }}} closedir($handle); } // output $al = $dc.' '.$fc; $allz = explode(' ',$al); echo "Step 1. Please check the first box for each folder you do not wish to include in sitemap.

"; for ($sc=1; $sc $allz[$sc] $c2
"; }} // add textbox for filenames to exclude echo '

5. Check Box when Finished.

Submitting without checking the finished box will highlight the currently checked choices, making it easier to verify what is checked and what is not.'; } ?>