3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php include 'config.php'; $user = $_POST['username']; $pass = $_POST['password']; if($_SERVER['REQUEST_METHOD'] == "POST"){ if($user == "" or $pass == ""){ echo '<div class="errorbox">Please fill in all fields!</div>'; }else{ $username = trim(mysqli_real_escape_string($user)); $password = trim(md5(mysqli_real_escape_string($pass))); $query = " SELECT username, password FROM accounts WHERE username = '$username' AND password = '$password' "; $results = mysqli_query($connection, $query) or die (mysqli_error()); $num_row = mysqli_num_rows($results); if($num_row == 1){ while($row = mysqli_fetch_array($results)){ $_COOKIE['userId'] = $row['userId']; header("Location: register.php"); } }else{ return false; } return true; } } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link type="image/gif" rel="icon" href="favicon.ico" /> <script type="text/javascript" src="js/logo_login.js"></script> <link type="text/css" rel="stylesheet" href="css/login.css" /> <title>M-Tutorials | Login</title> </head> <body> <img class="talk_cloud" src="images/already_account.png" /> <div class="login"> <form action="" method="post"> <input class="input_login" type="text" name="username" placeholder="Username" /> <input class="input_login" type="password" name="password" placeholder="Password" /> <input class="submit_login" type="submit" name="submit_login" value="Register" /> </form> <a href="index.php"><div class="logo"></div></a> </div> </body> </html>
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: include(config.php): failed to open stream: No such file or directory in /in/mAW0o on line 2 Warning: include(): Failed opening 'config.php' for inclusion (include_path='.:') in /in/mAW0o on line 2 Notice: Undefined index: username in /in/mAW0o on line 4 Notice: Undefined index: password in /in/mAW0o on line 5 Notice: Undefined index: REQUEST_METHOD in /in/mAW0o on line 7 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link type="image/gif" rel="icon" href="favicon.ico" /> <script type="text/javascript" src="js/logo_login.js"></script> <link type="text/css" rel="stylesheet" href="css/login.css" /> <title>M-Tutorials | Login</title> </head> <body> <img class="talk_cloud" src="images/already_account.png" /> <div class="login"> <form action="" method="post"> <input class="input_login" type="text" name="username" placeholder="Username" /> <input class="input_login" type="password" name="password" placeholder="Password" /> <input class="submit_login" type="submit" name="submit_login" value="Register" /> </form> <a href="index.php"><div class="logo"></div></a> </div> </body> </html>
Output for hhvm-3.10.0 - 3.12.0
Warning: File not found: config.php in /in/mAW0o on line 2 Notice: Undefined index: username in /in/mAW0o on line 4 Notice: Undefined index: password in /in/mAW0o on line 5 Notice: Undefined index: REQUEST_METHOD in /in/mAW0o on line 7 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link type="image/gif" rel="icon" href="favicon.ico" /> <script type="text/javascript" src="js/logo_login.js"></script> <link type="text/css" rel="stylesheet" href="css/login.css" /> <title>M-Tutorials | Login</title> </head> <body> <img class="talk_cloud" src="images/already_account.png" /> <div class="login"> <form action="" method="post"> <input class="input_login" type="text" name="username" placeholder="Username" /> <input class="input_login" type="password" name="password" placeholder="Password" /> <input class="submit_login" type="submit" name="submit_login" value="Register" /> </form> <a href="index.php"><div class="logo"></div></a> </div> </body> </html>
Output for 5.1.0 - 5.2.17
Warning: include(config.php): failed to open stream: No such file or directory in /in/mAW0o on line 2 Warning: include(): Failed opening 'config.php' for inclusion (include_path='.:') in /in/mAW0o on line 2 Notice: Undefined index: username in /in/mAW0o on line 4 Notice: Undefined index: password in /in/mAW0o on line 5 Notice: Undefined index: REQUEST_METHOD in /in/mAW0o on line 7 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link type="image/gif" rel="icon" href="favicon.ico" /> <script type="text/javascript" src="js/logo_login.js"></script> <link type="text/css" rel="stylesheet" href="css/login.css" /> <title>M-Tutorials | Login</title> </head> <body> <img class="talk_cloud" src="images/already_account.png" /> <div class="login"> <form action="" method="post"> <input class="input_login" type="text" name="username" placeholder="Username" /> <input class="input_login" type="password" name="password" placeholder="Password" /> <input class="submit_login" type="submit" name="submit_login" value="Register" /> </form> <a href="index.php"><div class="logo"></div></a> </div> </body> </html>
Output for 4.3.2 - 5.0.5
Warning: main(config.php): failed to open stream: No such file or directory in /in/mAW0o on line 2 Warning: main(): Failed opening 'config.php' for inclusion (include_path='.:') in /in/mAW0o on line 2 Notice: Undefined index: username in /in/mAW0o on line 4 Notice: Undefined index: password in /in/mAW0o on line 5 Notice: Undefined index: REQUEST_METHOD in /in/mAW0o on line 7 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link type="image/gif" rel="icon" href="favicon.ico" /> <script type="text/javascript" src="js/logo_login.js"></script> <link type="text/css" rel="stylesheet" href="css/login.css" /> <title>M-Tutorials | Login</title> </head> <body> <img class="talk_cloud" src="images/already_account.png" /> <div class="login"> <form action="" method="post"> <input class="input_login" type="text" name="username" placeholder="Username" /> <input class="input_login" type="password" name="password" placeholder="Password" /> <input class="submit_login" type="submit" name="submit_login" value="Register" /> </form> <a href="index.php"><div class="logo"></div></a> </div> </body> </html>
Output for 4.3.0 - 4.3.1
Warning: main(config.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/mAW0o on line 2 Warning: main() [http://www.php.net/function.main]: Failed opening 'config.php' for inclusion (include_path='.:') in /in/mAW0o on line 2 Notice: Undefined index: username in /in/mAW0o on line 4 Notice: Undefined index: password in /in/mAW0o on line 5 Notice: Undefined index: REQUEST_METHOD in /in/mAW0o on line 7 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link type="image/gif" rel="icon" href="favicon.ico" /> <script type="text/javascript" src="js/logo_login.js"></script> <link type="text/css" rel="stylesheet" href="css/login.css" /> <title>M-Tutorials | Login</title> </head> <body> <img class="talk_cloud" src="images/already_account.png" /> <div class="login"> <form action="" method="post"> <input class="input_login" type="text" name="username" placeholder="Username" /> <input class="input_login" type="password" name="password" placeholder="Password" /> <input class="submit_login" type="submit" name="submit_login" value="Register" /> </form> <a href="index.php"><div class="logo"></div></a> </div> </body> </html>