3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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($_GET['id']){ $gid = $_GET['id']; $qcheck = mysql_query("SELECT * FROM groups WHERE id = '$gid'") or die("Error! Cheating the system is not tolerated here!"); $g = mysql_fetch_array($qcheck); $type = $g['type']; $qv = mysql_num_rows($qcheck); if($qv==0){ header("Location: /groups/?msg=No such group exists!"); } $time=time(); $qgroups = mysql_query("SELECT * FROM groupmembers WHERE member = '$user_id' AND id = '$gid' AND flag = '1'"); $countgroups = mysql_num_rows($qgroups); if($countgroups == 1){ die("Error: You are already a member of this group"); } else { $qchk = mysql_query("SELECT * FROM groupmembers WHERE member = '$user_id' AND id = '$gid'"); $grp = mysql_fetch_array($qchk); if($grp['flag']=='0'){ mysql_query("UPDATE groupmembers SET flag = '2' WHERE `member`='$user_id' AND `id`='$gid'") or die("Error occured!"); header("Location: /groups/?id=".$gid."&msg=You was a deleted or kickedout member of this group. However, the request to join this group is sent to the admin"); } elseif($grp['flag']=='2'){ header("Location: /groups/?id=".$gid."&msg=Your request to join this group is already pending!"); } elseif($grp['flag']=='3') { header("Location /groups/?id=".$gid."&msg=Your request to join this group is already pending!); } else { if($type=='closed') { $query = mysql_query("INSERT INTO `groupmembers` (id, member, flag, created) VALUES ('$gid', '$user_id', '3','$time')") or die(mysql_error()); header("Location: /groups/?id=".$gid."&msg=Your request to join the group is sent!"); } elseif($type=='open'){ $query = mysql_query("INSERT INTO `groupmembers` (id, member, flag, created) VALUES ('$gid', '$user_id', '1','$time')") or die(mysql_error()); header("Location: /groups/?id=".$gid."&msg=You are now a member of this group"); } else { header("Location: /groups/?msg=Error: Group not found!"); } } } } else { echo "Invalid access"; } ?>
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected 'INSERT' (T_STRING) in /in/7II74 on line 42
Process exited with code 255.
Output for 5.3.0 - 5.3.26
Parse error: syntax error, unexpected T_STRING in /in/7II74 on line 42
Process exited with code 255.