3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit
Warning: include(): open_basedir restriction in effect. File(connect.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/65jIM on line 2 Warning: include(connect.php): Failed to open stream: Operation not permitted 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(): Session cannot be started after headers have already been sent in /in/65jIM on line 3 Warning: Undefined global variable $_SESSION in /in/65jIM on line 5 Warning: Trying to access array offset on value of type null 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 Warning: 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 rfc.property-hooks
Warning: include(): open_basedir restriction in effect. File(connect.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/65jIM on line 2 Warning: include(connect.php): Failed to open stream: Operation not permitted 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(): Session cannot be started after headers have already been sent in /in/65jIM on line 3 Warning: Undefined global variable $_SESSION in /in/65jIM on line 5 Warning: Trying to access array offset on null 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 Warning: 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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42 ms | 402 KiB | 8 Q