Please help me wi this code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Please help me wi this code

    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

    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";
     }
    ?>
    Thanks in Advance

    #2
    Here it is, just a little diferent way and edit it to your needs.


    Let me know if u need help.
    Last edited by arnage; 27.05.11, 14:34.
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

    Comment


      #3
      Originally posted by arnage View Post
      Here it is, just a little diferent way and edit it to your needs.


      Let me know if u need help.
      thanks really apreciate it

      Comment

      Working...
      X