View Single Post
Old 04-08-2005, 07:26 AM   #4
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Code:
<?php

// purpose: link to files modified less than $secs seconds ago
// as-is, no warranty, as-is, no warranty, as-is, no warranty
// save this script at http://www.your-domain.com/name.php
// use PhpDig to index http://www.your-domain.com/name.php
// delete name.php from the PhpDig admin panel when index done
// tip: visit http://www.php.net/manual/en/function.opendir.php

/************* Start Configuration */

// 600 seconds is 10 minutes or use $secs = 10*60; // 10 minutes times 60 seconds

$secs = 600;                                    // seconds since last modification

// separate (partial) names in $avoid1, $avoid2, $avoid3, $avoid4 with | character

$avoid1 = ".|..";                               // avoid files that match with these
$avoid2 = "private|hidden";                     // avoid files that start with these
$avoid3 = "htaccess|htpasswd|jpg|gif|png";      // avoid files that end with these
$avoid4 = "robots|admin|install|include";       // avoid files that contain these

/************* End Configuration */

$base = basename($_SERVER['PHP_SELF']);
$avoid = "^($avoid1|$base)\$|^($avoid2)|($avoid3)\$|($avoid4)";
$dirs = array(".");

while (list($key,$dir) = each($dirs)) {
	if ($handle = opendir($dir)) {
	        while (false !== ($name = readdir($handle))) {
			$loc = substr($dir."/".$name,2);
	                if (!is_dir($loc) && !eregi($avoid,$name)) {
	                        if (filemtime($loc) > time() - $secs) {
	                                echo "<a href=\"$loc\">$loc</a><br>\n";
	                        }
	                }
			elseif (is_dir($loc) && !eregi($avoid,$name)) {
				$dirs[] = "./".$loc;
			}
	       	}
	        closedir($handle);
	}
}

?>
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote