3v4l.org

run code in 300+ PHP versions simultaneously
<?php ob_start(); //research the use of this session_start(); //needed to create sessions - maintaining state is discussed above. ini_set('display_errors', 1); //turn on errors, use for debugging. $username = $_POST['username']; //refer to the superglobal arrays section above $password = $_POST['password']; $authorized = false; require ('dbconnection.php'); $sql = 'SELECT * from Login'; $rs = $conn->Execute($sql); //Using a While looping structure to check each record in the database while (!$rs->EOF) { if ($rs->Fields["UserName"]->Value=="$username" && $rs->Fields["Password"]->Value=="$password") { $_SESSION['auth'] = $rs->Fields['Auth']->Value; $_SESSION['username'] = $rs->Fields['UserName']->Value; $authorized = true; } $rs->MoveNext(); } # close the connection $rs->Close(); $conn->Close(); $rs = null; $conn = null; if (!$authorized) { header('loginInvalid.php'); // see pseudocode for authorize.php exit(); } else { header('index.php'); exit(); } ?>
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined array key "username" in /in/7X1aS on line 6 Warning: Undefined array key "password" in /in/7X1aS on line 7 Warning: require(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/7X1aS on line 10 Warning: require(dbconnection.php): Failed to open stream: Operation not permitted in /in/7X1aS on line 10 Fatal error: Uncaught Error: Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS:10 Stack trace: #0 {main} thrown in /in/7X1aS on line 10
Process exited with code 255.
Output for 8.0.13
Warning: Undefined array key "username" in /in/7X1aS on line 6 Warning: Undefined array key "password" in /in/7X1aS on line 7 Warning: require(dbconnection.php): Failed to open stream: No such file or directory in /in/7X1aS on line 10 Fatal error: Uncaught Error: Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS:10 Stack trace: #0 {main} thrown in /in/7X1aS on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.4.33
Notice: Undefined index: username in /in/7X1aS on line 6 Notice: Undefined index: password in /in/7X1aS on line 7 Warning: require(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10 Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.32
Notice: Undefined index: username in /in/7X1aS on line 6 Notice: Undefined index: password in /in/7X1aS on line 7 Warning: require(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/7X1aS on line 10 Warning: require(dbconnection.php): failed to open stream: Operation not permitted in /in/7X1aS on line 10 Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: require(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10 Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 7.1.20, 7.2.6
Notice: Undefined index: username in /in/7X1aS on line 6 Notice: Undefined index: password in /in/7X1aS on line 7 Warning: require(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in) in /in/7X1aS on line 10 Warning: require(dbconnection.php): failed to open stream: Operation not permitted in /in/7X1aS on line 10 Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Notice: Undefined index: username in /in/7X1aS on line 6 Notice: Undefined index: password in /in/7X1aS on line 7 Warning: require(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10 Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/7X1aS on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent in /in/7X1aS on line 3 Notice: Undefined index: username in /in/7X1aS on line 6 Notice: Undefined index: password in /in/7X1aS on line 7 Warning: require(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10 Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5
Warning: session_start(): Cannot send session cookie - headers already sent in /in/7X1aS on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent in /in/7X1aS on line 3 Notice: Undefined index: username in /in/7X1aS on line 6 Notice: Undefined index: password in /in/7X1aS on line 7 Warning: main(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10 Fatal error: main(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
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/7X1aS on line 3 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent in /in/7X1aS on line 3 Notice: Undefined index: username in /in/7X1aS on line 6 Notice: Undefined index: password in /in/7X1aS on line 7 Warning: main(dbconnection.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/7X1aS on line 10 Fatal error: main() [http://www.php.net/function.main]: Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10

preferences:
171.44 ms | 402 KiB | 307 Q