3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $username = $_POST['username']; $pass = $_POST['Password']; $mysqli = new mysqli("localhost", "438613", "website", "438613"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } else{ $username = $mysqli->real_escape_string($username); $pass = $mysqli->real_escape_string($pass); if($row=$mysqli->query("SELECT password FROM accounts WHERE username='$username'")){ if($row->num_rows == 0){ echo "No user with this email!"; header( "refresh:3;url=index.php" ); } else{ $result = $row->fetch_assoc(); $db_pass = $result["password"]; if (password_verify($pass, $db_pass)) { echo "The password is correct!"; session_start(); unset($_SESSION['user']); $_SESSION['user'] = $username; if (isset($_POST['remember'])) { $year = time() + 31536000; setcookie("user", $username, $year);; } header("Location:main.php"); exit(); } else{ echo "Incorrect password!"; header( "refresh:3;url=index.php" ); } } } else{ echo "Select error: (" . $mysqli->errno . ") " . $mysqli->error; } } ?>
Output for 7.0.0 - 7.1.0
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Uncaught Error: Class 'mysqli' not found in /in/5OmOM:6 Stack trace: #0 {main} thrown in /in/5OmOM on line 6
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Class 'mysqli' not found in /in/5OmOM on line 6
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Class 'mysqli' not found in /in/5OmOM on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Cannot instantiate non-existent class: mysqli in /in/5OmOM on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined index: username in /in/5OmOM on line 3 Notice: Undefined index: Password in /in/5OmOM on line 4 Fatal error: Cannot instantiate non-existent class: mysqli in /in/5OmOM on line 6