note 70600 deleted from function.readdir by tularis

From: Date: Sat, 21 Oct 2006 19:55:46 +0000
Subject: note 70600 deleted from function.readdir by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-118911@lists.php.net to get a copy of this message
Note Submitter: Adlez Reason: spam ---- I added a few things. So, here's the new code. <?php session_start(); if (!$_SESSION){ if (!$_POST){ print "<form action='' method='post'>"; print "<input type='text' name='user'><br />"; print "<input type='password' name='pass'><br />"; print "<input type='submit' value='Submit'>"; print "</form>"; die(""); } if ($_POST['user'] === "user" && $_POST['pass'] === "pass"){ session_register("authed"); $_SESSION['authed'] = 1; $self = $_SERVER['PHP_SELF']; header ("Location: $self"); } die(""); } ?> <html><head></head><body> <style type="text/css"> body{ background-color: 333333; color: lime; font: 10pt palatino linotype; scrollbar-face-color:#75726A; scrollbar-shadow-color:#555; scrollbar-highlight-color:#8F8C82; scrollbar-3dlight-color:#888; scrollbar-darkshadow-color:#111; scrollbar-track-color:#8F8C82; scrollbar-arrow-color:#aaa; } .text{ background-color: 333333; color: lime; font: 10pt palatino linotype; } a:link, a:visited { color : #00FF00; text-decoration: none; font: 11px Palatino Linotype; } </style> <table width="30%" height="100%" cellspacing="0" cellpadding="0" align="center" valign="top"><tr><td> <?php if (!$_GET['dir'] && !$_GET['view']){ $path = getcwd(); } if ($_GET['dir']){ $path = $_GET['dir']; } if (!$_GET['view']){ $dh = opendir($path); $up = explode("/" .$_GET['n'], $path); $up = $up[0]; print "<font size='1'>Dir - <a href='?dir=$path/$dir'>.</a></font><br>"; print "<font size='1'>Dir - <a href='?dir=$up'>..</a></font><br>"; while (($dir = readdir($dh)) !== false) { if ( $dir != "." && $dir != ".." ){ if (filetype("$path/$dir") === "dir"){ print "<font size='1'>Dir - <a href='?dir=$path/$dir&n=$dir'>$dir</a></font><br>"; } } } closedir($dh); $dh = opendir($path); while (($dir = readdir($dh)) !== false) { if (filetype("$path/$dir") === "file"){ print "<font size='1'>File - <a href='?view=$path/$dir&n=$dir'>$dir</a></font><br>"; } } closedir($dh); } if ($_GET['view']){ $path = $_GET['view']; $up = explode("/" .$_GET['n'], $path); $up = $up[0]; print "<p align='center'><font size='1'>Dir - <a href='?dir=$path/$dir'>.</a></font><br>"; print "<font size='1'>Dir - <a href='?dir=$up'>..</a></font><br></p>"; print "<textarea cols='85' rows='27' class='text' wrap='off'>"; $fh = fopen($path, 'r'); $file = htmlentities(fread($fh, filesize($path))); fclose($fh); print "$file</textarea>"; } ?> </td></tr><tr height="100%"><td bgcolor="333333"></td></tr></table>

« previous php.notes (#118911) next »