hi, i've been writing a liltle php script for 2 days now and i am stuck on a big problem which i can't find a solution for. i hope you guys can help me out, i have been searching all over the web for a solution and tried many things including converting html to xhtml using tidy but didn't work, i've tried caching in php also, now i'm just wondering what else i can try, i'm not a " real " coder because i just code when i really need something... here's the problem. I have downloaded 2,549 PK3 files (Game Maps files) for a total of 5Gb, each one of these PK3 (maps) files contains a /levelshots/ folder in which can be found a levelshot (game level) picture of the map. Example if the PK3 (map) file is named, A.pk3, the levelshot picture will be named, A.jpg, the problem is that some PK3 files have more than 1 pictures inside the PK3 file.. exemple... B.jpg + C.jpg + D.jpg + E.jpg, are in /levelshots/ folder of F.pk3, the PK3 file is a ZIP file, file.zip renamed to file.pk3. Now, from all these 2,549 pk3's, i have extracted, with a single DOS ZIP command, all the pictures inside the /levelshots/ folders in all the pk3 files to create a website Gallery on my website. Now, the script i started 2 days ago will check if a download link is available for each picture i have in my gallery but since some pictures are grouped together in one PK3 file and that my script loop through a gallery folder containing each .jpg files and removes the extension replacing it with .pk3, some links doesnt work.. exemple.. B.jpg becomes B.pk3.. C.jpg becomes C.pk3 etc.. but since B, C, D and E pictures are part of F.pk3, when the script does the http link check for B, C, D and E, the link wont be valid since there's no valid http link named B.pk3, C.pk3, D.pk3 and E.pk3 on the remote server...

This script will help me maintain valid links for 2,549 pk3's and to add new ones each day.. otherwise i will have to check them 1 by 1 and this is just impossible to maintain a gallery with that many pictures manually.

My script works, but it can only check 30 valid links of the 2,549 links, at a time. I really need you guys help on the script to check for the 2,549 valid links in one time. The script currently has 300 very simple lines of code only.

here's a screenshot of a testing directory " vid " which only contain few files and 1 directory.

[IMG]http://img208.imageshack.us/img208/9835/sceen004rj1.th.jpg[/IMG]

Map Validator.

this is the code,

<?php
##########################################################################
#                   KILLER - Map Validator v2.1
#
# Coded for SPGM Gallery 1.4.4 
# 
# Description: Validates files that are found on another server
#              and checks if the a download link is available.
#              You can then edit file maps.php and maps-block.php
#              to make ALL the download links work :-)
#
# ~ usage: /modules.php?name=Pictures&file=validator
# ~ date -3/10/2006 10:52 AM
##########################################################################
// Simple way to prevent someone to run this script other than you!
$yourIp = ""; // Enter Your IP
$ip = $_SERVER['REMOTE_ADDR'];
if($ip != $yourIp) { die('You can\'t access this file...'); }
 
########################
## Map Link Validator ##
########################
if (!defined('MODULE_FILE')) { die('You can\'t access this file directly...'); }
// Turning Off errors
error_reporting(0);
include_once(NUKE_BASE_DIR.'header.php');
 
// Get starting execution time 
$start = microtime_float();
 
$cfg = array();
$cfg['dircolor'] = "#00FF00"; // Change the directory color
$cfg['directory'] = "vid"; // folder name where Defrag pictures are.
$cfg['gallery_dir'] = "displays"; // folder name where Gallery pictures are stored.
$cfg['dump'] = "maps.txt"; // file name where bad links should be write to.
$cfg['thumbnail'] = '_thb_'; // gallery thumbnail names, ie: _thb_picture.jpg
$cfg['ignore_filez'] = array ('.', '..', '.htaccess', '.staccess', 'index.htm', 'index.html', 'index.php', 'validator.php', 'gal-desc.txt', 'vid-desc.txt', 'pic-desc.txt', 'spgm.conf');    
$cfg['ignore_dirz'] = array ('.', '..', 'cgi-bin', 'contrib', 'css', 'displays', 'getid3', 'lang', 'themes', 'tools', 'validator', 'vid');    
 
// Maps location
$cfg['server'] = "http://jamster.ath.cx/defrag/maps/";
$cfg['mapExentions'] = '.pk3';
 
// Getting the folder name where Gallery is installed
$cfg['module_name'] = '../modules/'.basename(dirname(__FILE__));
// Counts how many Good/Bad links were found
$cfg['GoodMapLinks'] = 0; //Needs to start at one
$cfg['BadMapLinks'] = 0; //Needs to start at one
// Testing...
$cfg['path'] = dirname(__FILE__).'/'.$cfg['directory'].'/';
//$cfg['path'] = dirname(__FILE__).'/'.$cfg['gallery_dir'].'/'.$cfg['directory'].'/';
$cfg['dumpFile'] = dirname(__FILE__).'/'.$cfg['dump'].'/';
// Stylez
$cfg['style_folders ']= 'style="border-top: #000000 1px solid;
                         border-bottom: #383838 1px solid; 
                         border-left: #000000 1px solid; 
                         border-right: #383838 1px solid; 
                         background: #CCCCCC; 
                         text-indent : 2px;"';
 
$cfg['style_files '] = 'style="border-top: #000000 1px solid;
                       border-bottom: #383838 1px solid; 
                       border-left: #000000 1px solid; 
                       border-right: #383838 1px solid; 
                       background: #111111; 
                       text-indent : 2px;"';
 
$cfg['style_link_bad '] = 'style="border-top: #000000 1px solid; 
                           border-bottom: #383838 1px solid; 
                           border-left: #000000 1px solid; 
                           border-right: #383838 1px solid; 
                           background: #990000; 
                           text-indent : 2px;"';
 
// Checking Jamster's for valid links 
function http_file_exists($path, $redir = false) {
    $path = parse_url($path);
    if (!isset($path['host'])) {
        return false;
    }
    $fp = fsockopen($path['host'], 80, $errno, $errstr, 4);
    if (!$fp) {
        return false;
    }
    if (!isset($path['path'])) {
     $path['path'] = '/';
    }
    $request = "HEAD $path[path] HTTP/1.0\r\n" .
     "Host: $path[host]\r\n" .
     "Connection: close\r\n\r\n";
    fputs($fp, $request);
    $pattern = '#HTTP/[\d\.]+ ' . ($redir ? '[23]' : '2') . '#';
    while (!feof($fp)) {
     $response = fgets($fp, 1024);
     if (preg_match($pattern, $response)) {
         return true;
     }
    }
    fclose($fp);
    return false;
}
// Calculating execution time 
function microtime_float() {  
    list ($msec, $sec) = explode(' ', microtime());  
    $microtime = (float)$msec + (float)$sec; 
    return $microtime;  
} 
// Counts how many files on current directory, ignoring gallery thumbnails, files in folders and files in array.
function files($dirname) {
 global $cfg;
    if ($handle = opendir($dirname)) {
        $count = 0;
            while (false !== ($filename = readdir($handle))) {
                if ($cfg['thumbnail'] != '' && !eregi('^'.$cfg['thumbnail'].'*', $filename) && !in_array($filename, $cfg['ignore_filez'])) {
                        $count++;
                }
            }
        closedir($handle);
    } else {
        $count = "<i>Unable to count files</i> - Directory: <b>$dirname</b>";
        }
    return $count;
}
// Directory Listing
function getDirectory($path = '.', $level = 0) {
 global $cfg;
    // Open the directory to the handle $dh
    $dh = @opendir($path);  
    // Loop through the directory 
    while (false !== ($file = readdir($dh))) { 
        // Check that this file is not to be ignored 
        if ($cfg['thumbnail'] != '' && !eregi('^'.$cfg['thumbnail'].'*', $file) && !in_array($file, $cfg['ignore_filez']) && !in_array($file, $cfg['ignore_dirz'])) { 
            // Just to add spacing to the list, to better 
            // show the directory tree. 
            $spaces = str_repeat('<img border=0 src='.$cfg['module_name'].'/validator/images/tree-L.gif height=14 width=7>',($level * 1)); 
            // Its a directory, so we need to keep reading down... 
            if (is_dir("$path/$file")) { 
                // Re-call this same function but on a new directory. 
                // this is what makes the function recursive.
                // Directory
                echo '  <tr>';
                echo '    <td width="50%" '.$cfg['style_folders '].'><font color="#000000">&nbsp; <b>'.$file.'</font></b></td>';
                echo '    <td width="50%" '.$cfg['style_folders '].' colspan="2"><font color="#000000">&nbsp; Validating Links in: <b>'.$file.'</font></b></td>';
                echo '  </tr>';
 
                // Files withing new folders
                echo '  <tr>';
                echo '    <td width="50%">&nbsp; '.getDirectory( "$path/$file", ($level+1) );'</td>';
                echo '    <td width="50%" colspan="2">&nbsp;</td>';
                echo '  </tr>';
 
        } else {
 
        // Removes extensions from files for Defrag Map validator
            $ext = strrchr($file, '.'); 
                if ($ext !== false) { 
                    $file = substr($file, 0, -strlen($ext));
                    $link = $cfg['server'].$file.$cfg['mapExentions'];
 
                // Just print out the filename
                    echo '  <tr>';
                    echo '    <td width="50%" '.$cfg['style_files '].'>&nbsp; '.$spaces.$file.'</td>';
 
                if(!http_file_exists($link, 1)) {
                    $txt = fopen($cfg['dumpFile'], "a");
                    $data = "$file.pk3\n";
                    fwrite($txt, $data);
                    fclose($txt);
     echo '    <td width="50%" '.$cfg['style_link_bad '].' colspan="2"><font color="FFFFFF">&nbsp; '.$spaces.$link.'</font></td>';
     ++$cfg['BadMapLinks'];  
                } else {
     echo '    <td width="50%" '.$cfg['style_files '].' colspan="2"><font color="FFFFFF">&nbsp; '.$spaces.$link.'</font></td>';
     ++$cfg['GoodMapLinks'];
                    }
                    echo '  </tr>';
                }                
            } 
        }        
    }
    // Close the directory handle
    closedir($dh);
} 
// Heading
OpenTable();
echo "<center><b>Map Validator</b></center>";
CloseTable();
OpenTable();
// Body
if (!opendir($cfg['path'])) {
    OpenTable();
    echo '&nbsp;&nbsp;&nbsp; Directory <b><font color="'.$cfg['dircolor'].'">'.$cfg['directory'].'</font></b> doesn\'t exist.<br><br>';
    echo '<center><b><font color="red">Unable to validate maps at the momment, check if you have entered to right path.</font></b></center><br>';
    CloseTable();
 
    } else {
 
// Title
    OpenTable();
        echo '<center>If you have several folders and files to list, this page can take some time to display.</center>';
    CloseTable();
echo '<center>Directory listing for <b><font color="#00FF00">'.$cfg['directory'].'</font></b></center>';
// List files
    OpenTable();
    echo '<div align="center">';
    echo '<center>';
    echo '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%">';
    echo '  <tr>';
    echo '    <td width="50%">';
 
    // Folders & Files section
    OpenTable();
    echo '<center>Folders and Files</center>';
    CloseTable();
 
    echo '    </td>';
    echo '    <td width="50%" colspan="2">';
 
    // Links section
    OpenTable();
    echo '<center>Links in red are dead</center>';
    CloseTable();
 
    echo '    </td>';
    echo '  </tr>';
// Get contents only from current directory where validator.php is
    //getDirectory(dirname(__FILE__));
// Get contents from current directory (in $cfg['path'] variable) plus within directories    
    getDirectory($cfg['path']);
 
    echo '  <tr>';
    echo '    <td width="50%" valign="top">';
 
    // Total Files section
    OpenTable();
    echo '&nbsp; Total: <b>'.files($cfg['path']).'</b>';
    CloseTable();
 
    echo '    </td>';
    echo '    <td width="25%" valign="top">';
 
    // Total Good Files section
    OpenTable();
    echo '&nbsp; Working: <b>'.$cfg['GoodMapLinks'].'</b>';
    CloseTable();
 
    echo '    </td>';
    echo '    <td width="25%" valign="top">';
 
    // Total Bad Files section
    OpenTable();
    echo '&nbsp; Bad: <b>'.$cfg['BadMapLinks'].'</b>';
    CloseTable();
 
    echo '    </td>';
    echo '  </tr>';     
    echo '</table>';
    echo '</center>';
    echo '</div>';
 
    CloseTable();
}
$end = microtime_float();
echo '<center><font size=2 color=#9E9E9E>Generated in ' . round($end - $start, 3) . ' seconds</font></center>';
CloseTable();
// Bottom
OpenTable();
    echo '<p align="right"><i><font size="2" color="#336699">KILLER - <a href="http://www.undrx.net/">Map Validator v2.1</a><br>';
    echo 'Updated ' . date("j/m/Y g:i A", filemtime(__FILE__));
    echo '</font></i></p>';
CloseTable();
include_once(NUKE_BASE_DIR.'footer.php');
?>

thanks

i've been working on it and added a cache, downloads the index.html from the remote site directory to check for links inside it, if caching index.html fails, tries, checking for links inside remote index.html without downloading it, if that also fails, tries it one last time with check each http link to be valid.

the script says KILLER on the header, i am KILLER ;) , please help anyone that can !!

this is the new code:

<?php
##########################################################################
#                   KILLER - Map Validator v2.4
#
# Coded for SPGM Gallery 1.4.4 
# 
# Description: Validates files that are found on another server
#              and checks if the a download link is available.
#              You can then edit file maps.php and maps-block.php
#              to make ALL the download links work :-)
#
# ~ usage: /modules.php?name=Pictures&file=validator
# ~ date -3/10/2006 10:52 AM
##########################################################################
// Simple way to prevent someone to run this script other than you!
$yourIp = ""; // Enter Your IP
$ip = $_SERVER['REMOTE_ADDR'];
if($ip != $yourIp) { die('You can\'t access this file...'); }
 
########################
## Map Link Validator ##
########################
if (!defined('MODULE_FILE')) { die('You can\'t access this file directly...'); }
// Debug
//error_reporting(E_ALL); // Turning On errors
error_reporting(0); // Turning Off errors
include_once(NUKE_BASE_DIR.'header.php');
$start = microtime_float(); // Get starting execution time 
$cfg = array();
$cfg['dircolor'] = '#00FF00'; // Change the directory color
$cfg['directory'] = 'vid'; // folder name where Defrag pictures are.
$cfg['gallery_dir'] = 'displays'; // folder name where Gallery pictures are stored.
$cfg['dump'] = 'maps.txt'; // file name where bad links should be write to.
$cfg['thumbnail'] = '_thb_'; // gallery thumbnail names, ie: _thb_picture.jpg
$cfg['ignore_filez'] = array ('.', '..', '.htaccess', '.staccess', 'index.htm', 'index.html', 'index.php', 'validator.php', 'gal-desc.txt', 'vid-desc.txt', 'pic-desc.txt', 'spgm.conf');    
$cfg['ignore_dirz'] = array ('.', '..', 'cgi-bin', 'contrib', 'css', 'displays', 'getid3', 'lang', 'themes', 'tools', 'validator', 'vid');    
 
// Maps location
$cfg['server'] = 'http://jamster.ath.cx/defrag/maps/';
$cfg['mapExentions'] = '.pk3';
// Cache
$cfg['cache_file'] = 'index.html'; // Name of cached file
$cfg['cache_path'] = dirname(__FILE__).'/cache/'.$cfg['cache_file'].''; // Where to place the cached file
$cfg['cache_timeout'] = 7200; // Number of seconds until the cache gets uninteresting
$cfg['cache_response'] = request_cache($cfg['server'], $cfg['cache_path'], $cfg['cache_timeout']); // check the cache
// Getting the folder name where Gallery is installed
$cfg['module_name'] = '../modules/'.basename(dirname(__FILE__));
// Counts how many Good/Bad links were found
$cfg['GoodMapLinks'] = 0; //Needs to start at one
$cfg['BadMapLinks'] = 0; //Needs to start at one
// Testing...
$cfg['path'] = dirname(__FILE__).'/'.$cfg['directory'].'/';
//$cfg['path'] = dirname(__FILE__).'/'.$cfg['gallery_dir'].'/'.$cfg['directory'].'/';
$cfg['dumpFile'] = dirname(__FILE__).'/'.$cfg['dump'].'/';
// Stylez
$cfg['style_folders ']= 'style="border-top: #000000 1px solid;
                         border-bottom: #383838 1px solid; 
                         border-left: #000000 1px solid; 
                         border-right: #383838 1px solid; 
                         background: #CCCCCC; 
                         text-indent : 2px;"';
 
$cfg['style_files '] = 'style="border-top: #000000 1px solid;
                       border-bottom: #383838 1px solid; 
                       border-left: #000000 1px solid; 
                       border-right: #383838 1px solid; 
                       background: #111111; 
                       text-indent : 2px;"';
 
$cfg['style_link_bad '] = 'style="border-top: #000000 1px solid; 
                           border-bottom: #383838 1px solid; 
                           border-left: #000000 1px solid; 
                           border-right: #383838 1px solid; 
                           background: #990000; 
                           text-indent : 2px;"';
 
// Caching
function request_cache($url, $dest_file, $timeout=7200) {
 if(!file_exists($url) || filemtime($url) < (time()-$timeout)) {
  $data = file_get_contents($url);
 
  if($data === false) {
        return false;
        }
 
  $tmpf = tempnam('/tmp','VALIDATOR');
  $fp = fopen($tmpf,"w");
  fwrite($fp, $data);
  fclose($fp);
  rename($tmpf, $dest_file);
        unlink($tmpf);
 } else {
  file_get_contents($dest_file);
 }
}
// Checking Jamster's for valid downloads 
function http_file_exists($path, $redir = false) {
    $path = parse_url($path);
    if (!isset($path['host'])) {
        return false;
    }
    $fp = fsockopen($path['host'], 80, $errno, $errstr, 4);
    if (!$fp) {
        return false;
    }
    if (!isset($path['path'])) {
     $path['path'] = '/';
    }
    $request = "HEAD $path[path] HTTP/1.0\r\n" .
     "Host: $path[host]\r\n" .
     "Connection: close\r\n\r\n";
    fputs($fp, $request);
    $pattern = '#HTTP/[\d\.]+ ' . ($redir ? '[23]' : '2') . '#';
    while (!feof($fp)) {
     $response = fgets($fp, 1024);
     if (preg_match($pattern, $response)) {
         return true;
     }
    }
    fclose($fp);
    return false;
}
// Checks inside a remote INDEX.html to see if a link exists
function check_back_link($remote_url, $your_link) {
    $match_pattern = preg_quote(rtrim($your_link, "/"), "/");
    $found = false;
    if ($handle = @fopen($remote_url, "r")) {
        while (!feof($handle)) {
            $part = fread($handle, 1024);
            if (preg_match("/<a(.*)href=[\"']".$match_pattern.
"(\/?)[\"'](.*)>(.*)<\/a>/", $part)) {
                $found = true;
                break;
            }
        } 
        fclose($handle);
    }
    return $found;
}
// Calculating execution time 
function microtime_float() {  
    list ($msec, $sec) = explode(' ', microtime());  
    $microtime = (float)$msec + (float)$sec; 
    return $microtime;  
}
// Returns a readable file size
function readable($size){
  $i=0;
  $iec = array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
  while (($size/1024)>1) {
   $size=$size/1024;
   $i++;
  }
  return substr($size,0,strpos($size,'.')+4).$iec[$i];
}
// Counts how many files on current directory, ignoring gallery thumbnails, files in folders and files in array.
function files($dirname) {
 global $cfg;
    if ($handle = opendir($dirname)) {
        $count = 0;
            while (false !== ($filename = readdir($handle))) {
                if ($cfg['thumbnail'] != '' && !eregi('^'.$cfg['thumbnail'].'*', $filename) && !in_array($filename, $cfg['ignore_filez'])) {
                        $count++;
                }
            }
        closedir($handle);
    } else {
        $count = "<i>Unable to count files</i> - Directory: <b>$dirname</b>";
        }
    return $count;
}
// Directory Listing
function display($path = '.', $level = 0) {
 global $cfg;
    // Open the directory to the handle $dh
    $dh = @opendir($path); 
 
    // Check the cache
    if($cfg['cache_response'] === false) {
        $cfg['cache'] = "bad";
    } else {
        $cfg['cache'] = "good";
    }
 
    // Loop through the directory 
    while (false !== ($file = readdir($dh))) { 
        // Check that this file is not to be ignored 
        if ($cfg['thumbnail'] != '' && !eregi('^'.$cfg['thumbnail'].'*', $file) && !in_array($file, $cfg['ignore_filez']) && !in_array($file, $cfg['ignore_dirz'])) { 
            // Just to add spacing to the list, to better 
            // show the directory tree. 
            $spaces = str_repeat('<img border=0 src='.$cfg['module_name'].'/validator/images/tree-L.gif height=14 width=7>',($level * 1)); 
 
            // Its a directory, so we need to keep reading down... 
            if (is_dir("$path/$file")) { 
                // Re-call this same function on new directory
                // Directory
                echo '  <tr>';
                echo '    <td width="50%" '.$cfg['style_folders '].'><font color="#000000">&nbsp; <b>'.$file.'</font></b></td>';
                echo '    <td width="50%" '.$cfg['style_folders '].' colspan="2"><font color="#000000">&nbsp; Validating Links in: <b>'.$file.'</font></b></td>';
                echo '  </tr>';
 
                // Files withing new folders
                echo '  <tr>';
                echo '    <td width="50%">&nbsp; '.display( "$path/$file", ($level+1) );'</td>';
                echo '    <td width="50%" colspan="2">&nbsp;</td>';
                echo '  </tr>';
 
            } else {
 
            // Removes extensions from files
                $ext = strrchr($file, '.'); 
 
                if ($ext !== false) { 
                    $file = substr($file, 0, -strlen($ext));
                    $cfg['backup_server'] = 'http://jamster.ath.cx/defrag/maps/';
                    $link = $file.$cfg['mapExentions'];
 
                // Just print out the filename
                    echo '  <tr>';
                    echo '    <td width="50%" '.$cfg['style_files '].'>&nbsp; '.$spaces.$file.'</td>';
 
                    if($cfg['cache'] == "good") {
                    //echo "good";
                        if(check_back_link($cfg['cache_path'], $link)) {
                        echo '    <td width="50%" '.$cfg['style_files '].' colspan="2"><font color="FFFFFF">&nbsp; '.$spaces.$cfg['server'].$link.'</font></td>';
                        ++$cfg['GoodMapLinks'];
                        } else {
                       //$txt = fopen($cfg['dumpFile'], "a");
                        //$data = "$file.pk3\n";
                        //fwrite($txt, $data);
                        //fclose($txt);
                        echo '    <td width="50%" '.$cfg['style_link_bad '].' colspan="2"><font color="FFFFFF">&nbsp; '.$spaces.$cfg['server'].$link.'</font></td>';
                        ++$cfg['BadMapLinks'];
                        }
                    } elseif($cfg['cache'] == "bad") {
 
                    //echo "bad";
                        if(check_back_link($cfg['backup_server'], $link)) {
                        echo '    <td width="50%" '.$cfg['style_files '].' colspan="2"><font color="FFFFFF">&nbsp; '.$spaces.$cfg['backup_server'].$link.'</font></td>';
                        ++$cfg['GoodMapLinks'];
                        } else {
                       //$txt = fopen($cfg['dumpFile'], "a");
                        //$data = "$file.pk3\n";
                        //fwrite($txt, $data);
                        //fclose($txt);
                        echo '    <td width="50%" '.$cfg['style_link_bad '].' colspan="2"><font color="FFFFFF">&nbsp; '.$spaces.$cfg['backup_server'].$link.'</font></td>';
                        ++$cfg['BadMapLinks'];
                        }
                    } else {
                        if(http_file_exists($cfg['server'], 1)) {
                        echo '    <td width="50%" '.$cfg['style_files '].' colspan="2"><font color="FFFFFF">&nbsp; '.$spaces.$cfg['backup_server'].$link.'</font></td>';
                        ++$cfg['GoodMapLinks'];
                        } else {
                        //$txt = fopen($cfg['dumpFile'], "a");
                        //$data = "$file.pk3\n";
                        //fwrite($txt, $data);
                        //fclose($txt);
                        echo '    <td width="50%" '.$cfg['style_link_bad '].' colspan="2"><font color="FFFFFF">&nbsp; '.$spaces.$cfg['backup_server'].$link.'</font></td>';
                        ++$cfg['BadMapLinks'];
                        }
                    }                    
                }
                echo '  </tr>';
            }                
        } 
    }
    // Close the directory handle
    closedir($dh);    
}
 
// Heading
OpenTable();
echo "<center><b>Map Validator</b></center>";
CloseTable();
OpenTable();
// Body
if (!opendir($cfg['path'])) {
// Cache size
if (file_exists($cfg['cache_path'])) {
 echo '<center><font size=2 color=#9E9E9E>Cache: '.readable(filesize($cfg['cache_path'])).'</font></center>';
    } else {
    echo '<center><font size=2 color=#9E9E9E>Cache: </font><font size=2 color=red>FAILED</font></center>';
}
    OpenTable();
    echo '&nbsp;&nbsp;&nbsp; Directory <b><font color="'.$cfg['dircolor'].'">'.$cfg['directory'].'</font></b> doesn\'t exist.<br><br>';
    echo '<center><b><font color="red">Unable to validate maps at the momment, check if you have entered the right path.</font></b></center><br>';
    CloseTable();
 
    } else {
// Cache size
if (file_exists($cfg['cache_path'])) {
 echo '<center><font size=2 color=#9E9E9E>Cache: '.readable(filesize($cfg['cache_path'])).'</font></center>';
    } else {
    echo '<center><font size=2 color=#9E9E9E>Cache: </font><font size=2 color=red>FAILED</font></center>';
}
// Title
    OpenTable();
        echo '<center>If you have several folders and files to list, this page can take some time to display.</center>';
    CloseTable();
echo '<center>Directory listing for <b><font color="#00FF00">'.$cfg['directory'].'</font></b></center>';
// List files
    OpenTable();
    echo '<div align="center">';
    echo '<center>';
    echo '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%">';
    echo '  <tr>';
    echo '    <td width="50%">';
 
    // Folders & Files section
    OpenTable();
    echo '<center>Folders and Files</center>';
    CloseTable();
 
    echo '    </td>';
    echo '    <td width="50%" colspan="2">';
 
    // Links section
    OpenTable();
    echo '<center>Links in red are dead</center>';
    CloseTable();
 
    echo '    </td>';
    echo '  </tr>';
// Get contents only from current directory where validator.php is
    //display(dirname(__FILE__));
// Get contents from current directory (in $cfg['path'] variable) plus within directories    
    display($cfg['path']);
 
    echo '  <tr>';
    echo '    <td width="50%" valign="top">';
 
    // Total Files section
    OpenTable();
    echo '&nbsp; Total: <b>'.files($cfg['path']).'</b>';
    CloseTable();
 
    echo '    </td>';
    echo '    <td width="25%" valign="top">';
 
    // Total Good Files section
    OpenTable();
    echo '&nbsp; Working: <b>'.$cfg['GoodMapLinks'].'</b>';
    CloseTable();
 
    echo '    </td>';
    echo '    <td width="25%" valign="top">';
 
    // Total Bad Files section
    OpenTable();
    echo '&nbsp; Bad: <b>'.$cfg['BadMapLinks'].'</b>';
    CloseTable();
 
    echo '    </td>';
    echo '  </tr>';     
    echo '</table>';
    echo '</center>';
    echo '</div>';
 
    CloseTable();
}
$end = microtime_float();
echo '<center><font size=2 color=#9E9E9E>Generated in ' . round($end - $start, 3) . ' seconds</font></center>';
CloseTable();
// Bottom
OpenTable();
    echo '<p align="right"><i><font size="2" color="#336699">KILLER - <a href="http://www.undrx.net/">Map Validator v2.4</a><br>';
    echo 'Updated ' . date("j/m/Y g:i A", filemtime(__FILE__));
    echo '</font></i></p>';
CloseTable();
include_once(NUKE_BASE_DIR.'footer.php');
?>

KILLER - Map Validator v2.4

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.