3v4l.org

run code in 300+ PHP versions simultaneously
<?php session_start(); //db include_once('db.php'); $user_email = $_SESSION['email']; $resultuid = mysql_query("SELECT `id` FROM `tbluser` WHERE `email` = '$user_email'") or die(mysql_error()); $row_id = mysql_fetch_assoc($resultuid); $user_id = $row_id['id']; // id of the user if(isSet($_POST['comment'])){ $gid=$_GET['gid']; $comment=$_POST['comment']; $msg_id=$_POST['msg_id']; $ip=$_SERVER['REMOTE_ADDR']; $comment=htmlentities($comment); $time=time(); $ip=$_SERVER['REMOTE_ADDR']; $query = mysql_query("SELECT id,comment FROM `group_comments` WHERE uid='$user_id' and msg_id='$msg_id' order by id desc limit 1 ") or die(mysql_error()); $result = mysql_fetch_array($query); if ($comment!=$result['comment']) { $query = mysql_query("INSERT INTO `group_comments` (comment, uid, msg_id, created) VALUES ('$comment', '$uid','$msg_id', '$time')") or die(mysql_error()); $newquery = mysql_query("SELECT id, uid, comment, msg_id, created FROM group_comments WHERE uid='$user_id' AND msg_id='$msg_id' order by id desc limit 1 "); $result = mysql_fetch_array($newquery); $com_id=result['id']; $comment=tolink(htmlentities($result['comment'] )); $time=$result['created']; $uid=$result['uid']; $uinf = mysql_query("SELECT * FROM `tbluser` WHERE `id` = '$uid'") or die(mysql_error()); $row_user = mysql_fetch_array($uinf); $fullname = $row_user['fname'].' '.$row_user['lname']; // full name of user $user_photo = $row_user['photo']; $user_photo="http://nitofa.com/user_pics/users/$user_photo"; header("Location: /groups/?id=".$gid."&msg=Comment posted!#stcommentbody".$com_id); ?> <div class="stcommentbody" id="stcommentbody<?php echo $com_id; ?>"> <div class="stcommentimg"> <img src="<?php echo $user_photo; ?>" class='small_face'/> </div> <div class="stcommenttext"> <!-- <a class="stcommentdelete" href="#" id='<?php echo $com_id; ?>'>X</a> --> <b><a href="<?php echo 'http://nitofa.com/browse-user.php?fid='.$uid;?>"><?php echo $fullname; ?></a></b> <?php echo $comment; ?> <div class="stcommenttime"><?php time_stamp($time); ?></div> </div> </div> <?php } } ?>
Output for 7.1.26 - 7.1.33, 7.2.17 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
Warning: include_once(): open_basedir restriction in effect. File(db.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/WcpaI on line 5 Warning: include_once(db.php): failed to open stream: Operation not permitted in /in/WcpaI on line 5 Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/WcpaI on line 5 Notice: Undefined index: email in /in/WcpaI on line 7 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/WcpaI:9 Stack trace: #0 {main} thrown in /in/WcpaI on line 9
Process exited with code 255.
Output for 7.1.20, 7.2.6
Warning: include_once(): open_basedir restriction in effect. File(db.php) is not within the allowed path(s): (/tmp:/in) in /in/WcpaI on line 5 Warning: include_once(db.php): failed to open stream: Operation not permitted in /in/WcpaI on line 5 Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/WcpaI on line 5 Notice: Undefined index: email in /in/WcpaI on line 7 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/WcpaI:9 Stack trace: #0 {main} thrown in /in/WcpaI on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/WcpaI on line 5 Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/WcpaI on line 5 Notice: Undefined index: email in /in/WcpaI on line 7 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/WcpaI:9 Stack trace: #0 {main} thrown in /in/WcpaI on line 9
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/WcpaI on line 5 Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/WcpaI on line 5 Notice: Undefined index: email in /in/WcpaI on line 7 Fatal error: Call to undefined function mysql_query() in /in/WcpaI on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '[' in /in/WcpaI on line 32
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/WcpaI on line 32
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/WcpaI on line 32
Process exited with code 255.

preferences:
158.17 ms | 401 KiB | 252 Q