tokmaz Posted February 9, 2007 Share Posted February 9, 2007 Hi, im currently making a Intranet for local company, but i'm having some trouble with a PHP file browsing script. The security of the script is non important, because this is only to be used locally by the company. The script will link to files and folders on the server, so that you can browse though them and open them. This is my code for the script: $rotdir = "intranett"; //Hvor skal den lete etter filer? if (isset($_GET['undermappe'])){ $sub = $_GET['undermappe']; $dirname = "$rotdir/$sub/"; } else { $dirname = "$rotdir/"; } $dirhandle = opendir($dirname); //Åpne mappen while($file = readdir($dirhandle)) //Loop gennom mappen { if ($file != "." && $file != "..") //Fjern . og .. { if (is_file($dirname.$file)) //Sjekk om det er en fil eller en mappe { echo "<img src='images/fil_ikon.png' /> <a href='" . $dirname.$file . "'>" . $file . "</a><br />"; } else { echo "<img src='images/mappe_ikon.png' /> <a href='" . $_SERVER['PHP_SELF'] . "?undermappe=" . $file . "'>" . $file . "</a><br />"; } } } ?> You can view the temp site here: http://staerk.eksponett.no My problem is to make the script work in more than one sub directory. I'm not very skilled in PHP, so can't figure out how. I really appriciate any help Link to comment https://forums.phpfreaks.com/topic/37747-need-some-help-with-a-php-file-browsing-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.