3v4l.org

run code in 300+ PHP versions simultaneously
<?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 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 7.2.29 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<!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 8.0.13
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Check Login</title> </head> <body> Warning: Undefined array key "txtUsername" in /in/ej673 on line 15 Warning: Undefined array key "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 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.4.33
<!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 7.3.32 - 7.3.33
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Check Login</title> </head> <body> 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 7.1.20, 7.2.6
<!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(): open_basedir restriction in effect. File(connect.php) is not within the allowed path(s): (/tmp:/in) in /in/ej673 on line 17 Warning: include(connect.php): failed to open stream: Operation not permitted 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.4.45, 5.5.0 - 5.5.36, 5.6.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 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 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>

preferences:
238.5 ms | 404 KiB | 348 Q