3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Zugangsdaten $benutzername = 'Otto'; $passwort = 'geheim'; // Session starten session_start(); // Variablen deklarieren $_SESSION['angemeldet'] = false; $fehlermeldung = ''; // Wurde das Formular abgeschickt? if (isset( $_POST['login'] )) { // Maskierende Slashes aus POST Array entfernen if (get_magic_quotes_gpc()) { $_POST = array_map( 'stripslashes', $_POST ); } // Benutzereingabe mit Zugangsdaten vergleichen if (strtolower( $benutzername ) == strtolower( trim( $_POST['benutzer'] )) && $passwort == trim( $_POST['passwort'] )) { // Wenn die Anmeldung korrekt war Session Variable setzen // und auf die geheime Seite weiterleiten $_SESSION['angemeldet'] = true; header( 'location: geheim_einfach.php' ); exit; } else { // Wenn die Anmeldung fehlerhaft war, Fehlermeldung setzen $fehlermeldung = '<h3>Die Anmeldung war fehlerhaft!</h3>'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpBuddy.eu - Login Script</title> </head> <body> <?php // Falls die Fehlermeldung gesetzt ist if ($fehlermeldung) echo $fehlermeldung; ?> <form id="loginform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="benutzer">Benutzer: </label><input type="text" name="benutzer" id="benutzer" value="" /><br /> <label for="passwort">Passwort: </label><input type="password" name="passwort" id="passwort" value="" /><br /> <input type="submit" name="login" id="login" value="Anmelden" /> </form> </body> </html><?php
Output for 7.4.3 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.21, 8.3.0 - 8.3.9
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpBuddy.eu - Login Script</title> </head> <body> <form id="loginform" method="post" action="/in/h6b3v"> <label for="benutzer">Benutzer: </label><input type="text" name="benutzer" id="benutzer" value="" /><br /> <label for="passwort">Passwort: </label><input type="password" name="passwort" id="passwort" value="" /><br /> <input type="submit" name="login" id="login" value="Anmelden" /> </form> </body> </html>
Output for 5.4.0 - 5.4.24, 5.5.0 - 5.5.8, 7.3.32 - 7.3.33
Parse error: syntax error, unexpected end of file in /in/h6b3v on line 61
Process exited with code 255.
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 7.2.29 - 7.2.33, 7.3.16 - 7.3.31
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpBuddy.eu - Login Script</title> </head> <body> <form id="loginform" method="post" action="/in/h6b3v"> <label for="benutzer">Benutzer: </label><input type="text" name="benutzer" id="benutzer" value="" /><br /> <label for="passwort">Passwort: </label><input type="password" name="passwort" id="passwort" value="" /><br /> <input type="submit" name="login" id="login" value="Anmelden" /> </form> </body> </html><?php
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/h6b3v on line 8 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/h6b3v:8) in /in/h6b3v on line 8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpBuddy.eu - Login Script</title> </head> <body> <form id="loginform" method="post" action=""> <label for="benutzer">Benutzer: </label><input type="text" name="benutzer" id="benutzer" value="" /><br /> <label for="passwort">Passwort: </label><input type="password" name="passwort" id="passwort" value="" /><br /> <input type="submit" name="login" id="login" value="Anmelden" /> </form> </body> </html><?php
Output for 4.3.0 - 4.3.1
Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent in /in/h6b3v on line 8 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/h6b3v:8) in /in/h6b3v on line 8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpBuddy.eu - Login Script</title> </head> <body> <form id="loginform" method="post" action=""> <label for="benutzer">Benutzer: </label><input type="text" name="benutzer" id="benutzer" value="" /><br /> <label for="passwort">Passwort: </label><input type="password" name="passwort" id="passwort" value="" /><br /> <input type="submit" name="login" id="login" value="Anmelden" /> </form> </body> </html><?php

preferences:
213.72 ms | 404 KiB | 264 Q