3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php session_start(); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Check Login</title> </head> <body> <? $txtUsername =$_POST['txtUsername']; $txtPassword1 =$_POST['txtPassword1']; include("connect.php"); $strSQL = "SELECT * FROM login WHERE username = '".$txtUsername."' and password = '".$txtPassword1."'"; $objQuery = mysql_query($strSQL); $objResult = mysql_fetch_array($objQuery); if(!$objResult) { ?> <script type="text/javascript"> alert("กรุณาตรวจสอบ Username และ Password") </script> <? echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=login.php'>"; exit(); } else { $username = $_POST['txtUsername']; ?> <!--<script type="text/javascript"> alert("<? echo $username ?>" ); </script>--> <? $_SESSION['myValue']= $username; $sql = "Select * from login where username='$username' "; echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=menu2.php'>"; } mysql_close(); ?> </body> </html>
Output for 7.0.0 - 7.1.0
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Check Login</title> </head> <body> Notice: Undefined index: txtUsername in /in/ej673 on line 15 Notice: Undefined index: txtPassword1 in /in/ej673 on line 16 Warning: include(connect.php): failed to open stream: No such file or directory in /in/ej673 on line 17 Warning: include(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/ej673 on line 17 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/ej673:20 Stack trace: #0 {main} thrown in /in/ej673 on line 20
Process exited with code 255.
Output for 5.4.0 - 5.6.28
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Check Login</title> </head> <body> Notice: Undefined index: txtUsername in /in/ej673 on line 15 Notice: Undefined index: txtPassword1 in /in/ej673 on line 16 Warning: include(connect.php): failed to open stream: No such file or directory in /in/ej673 on line 17 Warning: include(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/ej673 on line 17 Fatal error: Call to undefined function mysql_query() in /in/ej673 on line 20
Process exited with code 255.
Output for 5.2.3 - 5.3.29
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Check Login</title> </head> <body> <? $txtUsername =$_POST['txtUsername']; $txtPassword1 =$_POST['txtPassword1']; include("connect.php"); $strSQL = "SELECT * FROM login WHERE username = '".$txtUsername."' and password = '".$txtPassword1."'"; $objQuery = mysql_query($strSQL); $objResult = mysql_fetch_array($objQuery); if(!$objResult) { ?> <script type="text/javascript"> alert("กรุณาตรวจสอบ Username และ Password") </script> <? echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=login.php'>"; exit(); } else { $username = $_POST['txtUsername']; ?> <!--<script type="text/javascript"> alert("<? echo $username ?>" ); </script>--> <? $_SESSION['myValue']= $username; $sql = "Select * from login where username='$username' "; echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=menu2.php'>"; } mysql_close(); ?> </body> </html>
Output for 4.3.2 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/ej673 on line 1 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/ej673:1) in /in/ej673 on line 1 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Check Login</title> </head> <body> <? $txtUsername =$_POST['txtUsername']; $txtPassword1 =$_POST['txtPassword1']; include("connect.php"); $strSQL = "SELECT * FROM login WHERE username = '".$txtUsername."' and password = '".$txtPassword1."'"; $objQuery = mysql_query($strSQL); $objResult = mysql_fetch_array($objQuery); if(!$objResult) { ?> <script type="text/javascript"> alert("กรุณาตรวจสอบ Username และ Password") </script> <? echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=login.php'>"; exit(); } else { $username = $_POST['txtUsername']; ?> <!--<script type="text/javascript"> alert("<? echo $username ?>" ); </script>--> <? $_SESSION['myValue']= $username; $sql = "Select * from login where username='$username' "; echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=menu2.php'>"; } mysql_close(); ?> </body> </html>
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/ej673 on line 1 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/ej673:1) in /in/ej673 on line 1 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Check Login</title> </head> <body> <? $txtUsername =$_POST['txtUsername']; $txtPassword1 =$_POST['txtPassword1']; include("connect.php"); $strSQL = "SELECT * FROM login WHERE username = '".$txtUsername."' and password = '".$txtPassword1."'"; $objQuery = mysql_query($strSQL); $objResult = mysql_fetch_array($objQuery); if(!$objResult) { ?> <script type="text/javascript"> alert("กรุณาตรวจสอบ Username และ Password") </script> <? echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=login.php'>"; exit(); } else { $username = $_POST['txtUsername']; ?> <!--<script type="text/javascript"> alert("<? echo $username ?>" ); </script>--> <? $_SESSION['myValue']= $username; $sql = "Select * from login where username='$username' "; echo "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=menu2.php'>"; } mysql_close(); ?> </body> </html>