problem with site map
Posted: Tue Oct 30, 2007 12:47 pm
hello, I think i have some directory problem with free-downloaded sitemap php script.
The php code shown below is generating sitemap by scanning root directory... everythings go right, just if I click on some link from sitemap, it will show me
my root dir is C:\webdev\intranet\
The php code shown below is generating sitemap by scanning root directory... everythings go right, just if I click on some link from sitemap, it will show me
... does anyone know wheres the problem? i am newbie in php so I will be really appreciate for every help!!ERROR 404 Object not found!
my root dir is C:\webdev\intranet\
Code: Select all
<?php
// W3C Markup Validation Service - http://validator.w3.org/
// Choose which format you want EzMap to validate in.
// Valid HTML 4.01 Transitional or Valid XHTML 1.0 Transitional
// validation format, 0 for XHTML, 1 for HTML - Choose one or the other!
$ezmapvalidate = 1;
// Set this to NO ( 0 ) to NOT display the W3C Valid Button
// Show valid format button at bottom of page, 1 for YES, 0 for NO
$ezmap_valid_image = 0;
// User configuration
// Show size of each file, 1 for YES, 0 for NO
$showsize = 0;
// Array with file types to display and the images to use.
// Use the below to set which files you want searched and displayed.
// Uncomment for each you wish to show.
// Syntax: $display['filetype'] = "image";
$display['html'] = "img/html.gif";
$display['htm'] = "img/html.gif";
$display['shtml'] = "img/html.gif";
$display['php'] = "img/php.gif";
$display['pdf'] = "img/pdf.gif";
$display['gif'] = "img/gif.gif";
$display['jpg'] = "img/jpg.gif";
$display['png'] = "img/png.gif";
//$display['bmp'] = "img/bmp.gif";
//$display['tif'] = "img/tif.gif";
//$display['ico'] = "img/ico.gif";
$display['txt'] = "img/txt.gif";
$display['doc'] = "img/doc.gif";
$display['fla'] = "img/fla.gif";
$display['swf'] = "img/swf.gif";
//$display['zip'] = "img/zip.gif";
//$display['rar'] = "img/rar.gif";
//$display['avi'] = "img/avi.gif";
//$display['mpg'] = "img/mpg.gif";
//$display['mpeg'] = "img/mpg.gif";
//$display['mov'] = "img/mov.gif";
//$display['wmv'] = "img/wmv.gif";
//$display['midi'] = "img/midi.gif";
//$display['mp3'] = "img/mp3.gif";
//$display['wav'] = "img/wav.gif";
//$display['wps'] = "img/default.gif";
// Array with directories to exclude.
// This used to exclude or NOT listed a directory.
// ADD the directories you do not want to be included or show.
// * If you exclude a directory, nothing inside it will be shown!
// Syntax: $excludedir[] = "directory";
$excludedir[] = "cgi-bin";
$excludedir[] = "phpMyAdmin";
$excludedir[] = "style";
$excludedir[] = "images";
$excludedir[] = "tinymce";
$excludedir[] = "admin";
$excludedir[] = "dynamic_content";
$excludedir[] = "feeds";
$excludedir[] = "includes";
$excludedir[] = "menu";
$excludedir[] = "resources";
$excludedir[] = "slideshow";
$excludedir[] = ".svn";
$excludedir[] = "img";
$excludedir[] = "director_test";
$excludedir[] = "gallery";
// Array with files to exclude.
// This used to exclude or NOT list pages, files and so on.
// ADD the file names you do not want to be included or show.
// * If you exclude a file, nothing with the same name will be shown!
// Syntax: $excludefile[] = "filename";
$excludefile[] = "phpinfo.php";
$excludefile[] = "test.html";
$excludefile[] = "test2.html";
$excludefile[] = "competitions.admin.php";
$excludefile[] = "documents.admin.php";
$excludefile[] = "informations.admin.php";
$excludefile[] = "ezmap.php";
/////////////////////////////////////////////////////////////
// DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOUR DOING! //
/////////////////////////////////////////////////////////////
$stime = gettimeofday();
// What are we looking at here?
$root = getcwd();
echo "$root";
$pre = explode("/", $_SERVER['REQUEST_URI']);
array_pop($pre);
$prefix = join("/", $pre);
// Uncomment the 2 lines below to create a tree of all files and directories on
// your webserver if the script is in a subdirectory. Or it will only show what
// is in the containing directory.
$root = str_replace($prefix, "", $root);
$prefix = "";
$root .= "/";
//$root = "./";
// Display server name and directory
if ($ezmapvalidate == 1) {
echo "<table width=\"90%\" class=\"ezmap\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
echo "<tr><td><img align=\"top\" src=\"img/server.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"\"> <b>http://".$_SERVER['SERVER_NAME']."/balfornet";
echo "$prefix/";
//echo "</b></td></tr><tr><td><img align=\"top\" src=\"img/line.gif\" width=\"7\" height=\"24\" border=\"0\" alt=\"\"></td></tr>\n";
} else {
echo "<table width=\"90%\" class=\"ezmap\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
echo "<tr><td><img align=\"top\" src=\"img/server.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"\" />\n";
echo " <b>http://".$_SERVER['SERVER_NAME']."/balfornet";
echo "$prefix/";
//echo "</b></td></tr><tr><td><img align=\"top\" src=\"img/line.gif\" width=\"7\" height=\"24\" border=\"0\" alt=\"\" /></td></tr>\n";
}
function get_extension($name) {
$ezmapvalidate = 1;
$array = explode(".", $name);
$retval = strtolower(array_pop($array));
return $retval;
}
// Recursion! And away we go...
// Set some globals and clean up a bit...
// What a messy person you are...
function list_dir($chdir) {
$ezmapvalidate = 1;
global $root, $prefix, $showsize, $display, $excludedir, $excludefile;
unset($sdirs);
unset($sfiles);
chdir($chdir);
$self = basename($_SERVER['PHP_SELF']);
$sdirs = "";
$sfiles = "";
// Open the current directory
$handle = opendir('.');
// Read the directory. If the item is a directory, place it in $sdirs.
// If it's a filetype we want, put it in $sfiles.
// If it is excluded, ignore it!
while ($file = readdir($handle))
{
if(is_dir($file) && $file != "." && $file != ".." && !in_array($file, $excludedir))
{ $sdirs[] = $file; }
elseif(is_file($file) && $file != "$self" && array_key_exists(get_extension($file), $display)
&& !in_array($file, $excludefile))
{ $sfiles[] = $file; }
}
// Count the slashes to determine how deep we are in the directory.
// Add lines to make it pretty.
$dir = getcwd();
$dir1 = str_replace($root, "", $dir."/");
$count = substr_count($dir1, "/") + substr_count($dir1, "\\");
// Display directory names and recursively list them.
if(is_array($sdirs)) {
sort($sdirs);
reset($sdirs);
for($y=0; $y<sizeof($sdirs); $y++) {
if ($ezmapvalidate == 1) {
echo "<tr><td>";
} else {
echo "<tr><td>";
}
for($z=1; $z<=$count; $z++)
{
if ($ezmapvalidate == 1) {
//echo "<img align=\"top\" src=\"img/line.gif\" width=\"7\" height=\"24\" border=\"0\" alt=\"\"> ";
} else {
//echo "<img align=\"top\" src=\"img/line.gif\" width=\"7\" height=\"24\" border=\"0\" alt=\"\" /> ";
}
}
if(is_array($sfiles))
{
if ($ezmapvalidate == 1) {
echo "<img align=\"top\" src=\"img/tshaped.gif\" width=\"10\" height=\"24\" border=\"0\" alt=\"\">";
} else {
echo "<img align=\"top\" src=\"img/tshaped.gif\" width=\"10\" height=\"24\" border=\"0\" alt=\"\" />";
}
}
else
{
if ($ezmapvalidate == 1) {
echo "<img align=\"top\" src=\"img/upangle.gif\" width=\"10\" height=\"24\" border=\"0\" alt=\"\">";
} else {
echo "<img align=\"top\" src=\"img/upangle.gif\" width=\"10\" height=\"24\" border=\"0\" alt=\"\" />";
}
}
if ($ezmapvalidate == 1) {
echo "<img align=\"top\" src=\"img/folder.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"\"> <a href=\"http://".$_SERVER['SERVER_NAME']."$prefix/$dir1$sdirs[$y]\" target=\"_top\">$sdirs[$y]</a>";
} else {
echo "<img align=\"top\" src=\"img/folder.gif\" width=\"20\" height=\"20\" border=\"0\" alt=\"\" /> <a href=\"http://".$_SERVER['SERVER_NAME']."$prefix/$dir1$sdirs[$y]\" target=\"_top\">$sdirs[$y]</a></td></tr>";
}
list_dir($dir."/".$sdirs[$y]);
}
}
chdir($chdir);
// Run through the array of files and show them.
if(is_array($sfiles)) {
sort($sfiles);
reset($sfiles);
$sizeof = sizeof($sfiles);
// What file types shall we display?
// You set these in the first few lines of this script.
for($y=0; $y<$sizeof; $y++) {
if ($ezmapvalidate == 1) {
echo "<tr><td class=\"ezmap_details\">";
} else {
echo "<tr><td class=\"ezmap_details\">";
}
for($z=1; $z<=$count; $z++)
{
if ($ezmapvalidate == 1) {
//echo "<img align=\"top\" src=\"img/line.gif\" width=\"7\" height=\"24\" border=\"0\" alt=\"\"> ";
} else {
//echo "<img align=\"top\" src=\"img/line.gif\" width=\"7\" height=\"24\" border=\"0\" alt=\"\" /> ";
}
}
if($y == ($sizeof -1))
{
if ($ezmapvalidate == 1) {
echo "<img align=\"top\" src=\"img/upangle.gif\" width=\"10\" height=\"24\" border=\"0\" alt=\"\">";
} else {
echo "<img align=\"top\" src=\"img/upangle.gif\" width=\"10\" height=\"24\" border=\"0\" alt=\"\" />";
}
} else {
if ($ezmapvalidate == 1) {
echo "<img align=\"top\" src=\"img/tshaped.gif\" width=\"10\" height=\"24\" border=\"0\" alt=\"\">";
} else {
echo "<img align=\"top\" src=\"img/tshaped.gif\" width=\"10\" height=\"24\" border=\"0\" alt=\"\" />";
}
}
if ($ezmapvalidate == 1) {
echo "<img align=\"top\" src=\"";
echo $display[get_extension($sfiles[$y])];
echo "\" border=\"0\" alt=\"\"> ";
echo "<a href=\"http://".$_SERVER['SERVER_NAME']."$prefix/$dir1$sfiles[$y]\" target=\"_top\">$sfiles[$y]</a>";
} else {
echo "<img align=\"top\" src=\"";
echo $display[get_extension($sfiles[$y])];
echo "\" border=\"0\" alt=\"\" /> ";
echo "<a href=\"http://".$_SERVER['SERVER_NAME']."$prefix/$dir1$sfiles[$y]\" target=\"_top\">$sfiles[$y]</a>";
}
if($showsize) {
$fsize = @filesize($sfiles[$y])/1024;
printf(" ( %.2f kB )", $fsize);
}
if ($ezmapvalidate == 1) {
echo "</td></tr>";
} else {
echo "</td></tr>";
}
}
if ($ezmapvalidate == 1) {
echo "<tr><td>";
} else {
echo "<tr><td>";
}
for($z=1; $z<=$count; $z++)
{
if ($ezmapvalidate == 1) {
//echo "<img align=\"top\" src=\"img/line.gif\" width=\"7\" height=\"24\" border=\"0\" alt=\"\"> ";
} else {
//echo "<img align=\"top\" src=\"img/line.gif\" width=\"7\" height=\"24\" border=\"0\" alt=\"\" /> ";
}
}
if ($ezmapvalidate == 1) {
echo "</td></tr>\n";
} else {
echo "</td></tr>\n";
}
}
}
list_dir($root);
if ($ezmapvalidate == 1) {
echo "</table><br>\n";
} else {
echo "</table><br />\n";
}
?>