3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php include "connect.php"; session_start(); date_default_timezone_set('UTC'); if($_SESSION['user']){ } else{ header("location:index.php"); } if($_SERVER['REQUEST_METHOD'] = "POST") //Added an if to keep the page secured { $details = $con->real_escape_string($_POST['details']); $time = strftime("%X");//time $date = strftime("%B %d, %Y");//date $decision ="no"; $con->select_db("main") or die("Cannot connect to database"); //Connect to database foreach($_POST['public'] as $each_check) //gets the data from the checkbox { if($each_check !=null ){ //checks if the checkbox is checked $decision = "yes"; //sets teh value } } $con->query("INSERT INTO list (details, date_posted, time_posted, public) VALUES ('$details','$date','$time','$decision')"); //SQL query header("location: home.php"); } else { header("location:home.php"); //redirects back to hom } ?>
Output for 7.0.5 - 7.1.0
Warning: include(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: include(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Notice: Undefined index: user in /in/65jIM on line 5 Warning: Cannot modify header information - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 8 Notice: Undefined variable: con in /in/65jIM on line 13 Fatal error: Uncaught Error: Call to a member function real_escape_string() on null in /in/65jIM:13 Stack trace: #0 {main} thrown in /in/65jIM on line 13
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Warning: include(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: include(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Notice: Undefined index: user in /in/65jIM on line 5 Warning: Cannot modify header information - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 8 Notice: Undefined variable: con in /in/65jIM on line 13 Fatal error: Uncaught Error: Call to a member function real_escape_string() on unknown in /in/65jIM:13 Stack trace: #0 {main} thrown in /in/65jIM on line 13
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Warning: File not found: connect.php in /in/65jIM on line 2 Notice: Undefined index: user in /in/65jIM on line 5 Notice: Undefined variable: con in /in/65jIM on line 13 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function real_escape_string() on a non-object (null)' in /in/65jIM:13 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Warning: include(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: include(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Notice: Undefined index: user in /in/65jIM on line 5 Warning: Cannot modify header information - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 8 Notice: Undefined variable: con in /in/65jIM on line 13 Fatal error: Call to a member function real_escape_string() on null in /in/65jIM on line 13
Process exited with code 255.
Output for 5.3.0 - 5.5.35
Warning: include(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: include(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Notice: Undefined index: user in /in/65jIM on line 5 Warning: Cannot modify header information - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 8 Notice: Undefined variable: con in /in/65jIM on line 13 Fatal error: Call to a member function real_escape_string() on a non-object in /in/65jIM on line 13
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Warning: include(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: include(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Notice: Undefined index: user in /in/65jIM on line 5 Warning: Cannot modify header information - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 8 Notice: Undefined variable: con in /in/65jIM on line 13 Fatal error: Call to a member function real_escape_string() on a non-object in /in/65jIM on line 13
Process exited with code 255.
Output for 5.1.0 - 5.2.2
Warning: include(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: include(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Notice: Undefined index: user in /in/65jIM on line 5 Notice: Undefined variable: con in /in/65jIM on line 13 Fatal error: Call to a member function real_escape_string() on a non-object in /in/65jIM on line 13
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: main(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: main(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Fatal error: Call to undefined function date_default_timezone_set() in /in/65jIM on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Warning: main(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: main(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Fatal error: Call to undefined function: date_default_timezone_set() in /in/65jIM on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Warning: main(connect.php): failed to open stream: No such file or directory in /in/65jIM on line 2 Warning: main(): Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Fatal error: Call to undefined function: date_default_timezone_set() in /in/65jIM on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: main(connect.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/65jIM on line 2 Warning: main() [http://www.php.net/function.main]: Failed opening 'connect.php' for inclusion (include_path='.:') in /in/65jIM on line 2 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent by (output started at /in/65jIM:2) in /in/65jIM on line 3 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/65jIM:2) in /in/65jIM on line 3 Fatal error: Call to undefined function: date_default_timezone_set() in /in/65jIM on line 4