note 108095 deleted from book.dir by danbrown

From: Date: Thu, 10 May 2012 17:43:07 +0000
Subject: note 108095 deleted from book.dir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187682@lists.php.net to get a copy of this message
Note Submitter: amal250 at gmail dot com ---- <form id="browserform" action="browser.php" method="post"> <?php $rootpath=''; if(isset($_POST['rootpath'])) $rootpath=$_POST['rootpath']; ?> <input type="text" id="rootpath" name="rootpath" value="<?php echo $rootpath;?>" /> <?php $handle=opendir($rootpath); if($handle!=null) while (false !== ($entry = readdir($handle))) { if(is_dir($rootpath."/".$entry)) echo "<a href='#' onclick='opendir(\"$entry\")'>$entry</a><br>"; else echo "<a href='#' onclick='openfile(\"$entry\")'>$entry</a><br>"; } ?> </form> <script type="text/javascript"> function opendir(dir) { if(dir=="..") { var path=document.getElementById("rootpath").value; var arr=path.split("/"); path=arr[0]; for(var i=1;i<arr.length-1;i++) path+="/"+arr[i]; document.getElementById("rootpath").value=path; browserform.submit(); } else { document.getElementById("rootpath").value+="/"+dir; browserform.submit(); } } function openfile(dir) { var path=document.getElementById("rootpath").value; window.open("player.php?path="+path+"/"+dir); } </script>

« previous php.notes (#187682) next »