JP128 Posted December 16, 2006 Share Posted December 16, 2006 [code] <?php $files = scandir($_SESSION['filedir1']); foreach ($files as $file){ if(is_dir($file)){ $file = $file."/"; } echo"<option value='$file' onClick=\"document.form1.filefrommenu.value='$file'\">".$file."</option>"; } ?> </select>[/code]what the other page gets: [code]<?phpif(isset($_POST['browsefile1'])){$dirtobrowse = $_POST['file1'];$_SESSION['filedir1'] = $_SESSION['filedir1'].$dirtobrowse;header("Location: revisedgetfile.php");}?>[/code]I don't know what else to use.... any suggestions? Link to comment https://forums.phpfreaks.com/topic/30861-directory-browsing-script-help/ Share on other sites More sharing options...
JP128 Posted December 16, 2006 Author Share Posted December 16, 2006 Can anyone help Link to comment https://forums.phpfreaks.com/topic/30861-directory-browsing-script-help/#findComment-142324 Share on other sites More sharing options...
heckenschutze Posted December 16, 2006 Share Posted December 16, 2006 Firstly, Injection is possible -> eg, set "file1" to "../../var/passwords/" or something :)Since its a smallish script, condense them into one file.and btw, what is your exact problem? Link to comment https://forums.phpfreaks.com/topic/30861-directory-browsing-script-help/#findComment-142339 Share on other sites More sharing options...
JP128 Posted December 16, 2006 Author Share Posted December 16, 2006 my problem is that it wont open the file.. if it isnt set then it is ../htdocs/ Link to comment https://forums.phpfreaks.com/topic/30861-directory-browsing-script-help/#findComment-142532 Share on other sites More sharing options...
JP128 Posted December 16, 2006 Author Share Posted December 16, 2006 Does anyone know how to create a really simple one?and if you do, what commands should I use?I want the files to be in an option box... and that is done... but when the user clicks browse, I want it to change to that dir... Link to comment https://forums.phpfreaks.com/topic/30861-directory-browsing-script-help/#findComment-142568 Share on other sites More sharing options...
trq Posted December 16, 2006 Share Posted December 16, 2006 Please have a read of the link in my signiture. You are unable to form a question. Link to comment https://forums.phpfreaks.com/topic/30861-directory-browsing-script-help/#findComment-142576 Share on other sites More sharing options...
JP128 Posted December 16, 2006 Author Share Posted December 16, 2006 Ok, here are my problems.I have a script that will output all of the files in the directory called /htdocs/ into an option list... No problem with seeing them. My problem is when I click browse, it sends it to a page that will see if that is what the user clicked, and still no problem. After it gets to there, and I want it to change the current directory, and then go back to the file page, the only problem is that the directory never changes... Link to comment https://forums.phpfreaks.com/topic/30861-directory-browsing-script-help/#findComment-142580 Share on other sites More sharing options...
JP128 Posted December 17, 2006 Author Share Posted December 17, 2006 Does anyone know? Link to comment https://forums.phpfreaks.com/topic/30861-directory-browsing-script-help/#findComment-142722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.