Hi all
im still a newgie in php and am working on a script for my mobile site
i got a free code that lists contens of a directory but it uses a deprecated eregi
could anyone pls help me on replacing this function
Thanks in Advance
im still a newgie in php and am working on a script for my mobile site
i got a free code that lists contens of a directory but it uses a deprecated eregi
could anyone pls help me on replacing this function
PHP Code:
<?php
$viewExt = '.html|.php|.css|.js|.txt'; // only filenames with these extensions will be displayed
$dirHandle = opendir('.');
while ($file = readdir($dirHandle)) {
if ($file != '.' && $file != '..' && @eregi("($viewExt)$",$file) && !@eregi("^index.",$file)) {
$stack[] = $file; // append filename to an array
}
}
closedir($dirHandle);
sort($stack);
foreach($stack as $value) {
echo '<a href="'.$value.'">'.$value.'</a><br>'."\n";
}
?>
Comment