3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php include "inc/conn.php"; include "inc/connmysql.php"; session_start(); if (isset($_SESSION['Username'])) { header("location:login_success.php"); } if (isset($_POST['Username'])) { ob_start(); $myUsername = $_POST['Username']; $myPassword = $_POST['password']; $sqlname = "SELECT * FROM dbo.Users WHERE Username='$myUsername' and Password='$myPassword'"; $params = array(); $options = array('Scrollable' => SQLSRV_CURSOR_KEYSET); $stmt = sqlsrv_query( $conn, $sqlname, $params, $options); $row_count = sqlsrv_num_rows( $stmt ); if($row_count==1){ $_SESSION['Username']= $myUsername; $_SESSION['Password']= $myPassword; $kb= $_SESSION['Username']; if (!$mysqli->query("CREATE TABLE IF NOT EXISTS user_log (id INT AUTO_INCREMENT PRIMARY KEY,user VARCHAR(15),state VARCHAR (7),ts TIMESTAMP)") || !$mysqli->query("INSERT INTO user_log (user, state) VALUES ('$kb', 'Login')")) { echo "Table creation failed: (" . $mysqli->errno . ") " . $mysqli->error; } header("location:login_success.php"); } else { echo "Wrong Username or Password"; if (!$mysqli->query("CREATE TABLE IF NOT EXISTS user_log (id INT AUTO_INCREMENT PRIMARY KEY,user VARCHAR(15),state VARCHAR (7),ts TIMESTAMP)") || !$mysqli->query("INSERT INTO user_log (user, state) VALUES ('user', 'LogFail')")) { echo "Table creation failed: (" . $mysqli->errno . ") " . $mysqli->error; } } ob_end_flush(); } else { header("location:sql.php"); } ?>
Output for 5.2.3 - 7.1.10
Warning: include(inc/conn.php): failed to open stream: No such file or directory in /in/5GCAf on line 2 Warning: include(): Failed opening 'inc/conn.php' for inclusion (include_path='.:') in /in/5GCAf on line 2 Warning: include(inc/connmysql.php): failed to open stream: No such file or directory in /in/5GCAf on line 3 Warning: include(): Failed opening 'inc/connmysql.php' for inclusion (include_path='.:') in /in/5GCAf on line 3 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/5GCAf:2) in /in/5GCAf on line 4 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/5GCAf:2) in /in/5GCAf on line 4 Warning: Cannot modify header information - headers already sent by (output started at /in/5GCAf:2) in /in/5GCAf on line 39
Output for 5.1.0 - 5.2.2
Warning: include(inc/conn.php): failed to open stream: No such file or directory in /in/5GCAf on line 2 Warning: include(): Failed opening 'inc/conn.php' for inclusion (include_path='.:') in /in/5GCAf on line 2 Warning: include(inc/connmysql.php): failed to open stream: No such file or directory in /in/5GCAf on line 3 Warning: include(): Failed opening 'inc/connmysql.php' for inclusion (include_path='.:') in /in/5GCAf on line 3 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/5GCAf:2) in /in/5GCAf on line 4 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/5GCAf:2) in /in/5GCAf on line 4
Output for 4.3.2 - 5.0.5
Warning: main(inc/conn.php): failed to open stream: No such file or directory in /in/5GCAf on line 2 Warning: main(): Failed opening 'inc/conn.php' for inclusion (include_path='.:') in /in/5GCAf on line 2 Warning: main(inc/connmysql.php): failed to open stream: No such file or directory in /in/5GCAf on line 3 Warning: main(): Failed opening 'inc/connmysql.php' for inclusion (include_path='.:') in /in/5GCAf on line 3 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/5GCAf:2) in /in/5GCAf on line 4 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/5GCAf:2) in /in/5GCAf on line 4
Output for 4.3.0 - 4.3.1
Warning: main(inc/conn.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/5GCAf on line 2 Warning: main() [http://www.php.net/function.main]: Failed opening 'inc/conn.php' for inclusion (include_path='.:') in /in/5GCAf on line 2 Warning: main(inc/connmysql.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/5GCAf on line 3 Warning: main() [http://www.php.net/function.main]: Failed opening 'inc/connmysql.php' for inclusion (include_path='.:') in /in/5GCAf on line 3 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent by (output started at /in/5GCAf:2) in /in/5GCAf on line 4 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/5GCAf:2) in /in/5GCAf on line 4