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(isset($_POST['delete_user']) && !empty($_POST['delete_user'])) { $gid = $_POST['gid']; $query4admin = mysql_query("SELECT * FROM groups WHERE id = '$gid' AND admin = '$user_id' AND active = '1'"); $admin = mysql_num_rows($query4admin); if($admin==1){ $delete_user = mysql_real_escape_string($_POST['delete_user']); mysql_query("UPDATE groupmembers SET flag = '0' WHERE `member`='$delete_user' AND `id`='$gid'") or die("Error occured!"); header('Location: /groups/?id='.$gid.'&msg=The user has been kicked out or deleted from the group!'); } else { echo "<b>You are not admin of this group</b> or this group is a deleted/suspended one!"; } } elseif(isset($_POST['group']) && !empty($$_POST['group'])) { $gid = mysql_real_escape_string($_POST['group']); $query4admin = mysql_query("SELECT * FROM groups WHERE id = '$gid' AND admin = '$user_id' AND active = '1'"); $admin = mysql_num_rows($query4admin); if($admin==1){ mysql_query("UPDATE groups SET active = '0' WHERE `id`='$gid' AND `admin`='$user_id'") or die("Error occured!"); header('Location: /groups/?msg=You group has been deleted!'); } else { echo "<b>You are not admin of this group</b> or this group is already deleted!"; } } ?>
Output for 7.0.0 - 7.1.0
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/VYlYj on line 4 Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/VYlYj on line 4 Notice: Undefined index: email in /in/VYlYj on line 6 Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/VYlYj:8 Stack trace: #0 {main} thrown in /in/VYlYj on line 8
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/VYlYj on line 4 Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/VYlYj on line 4 Notice: Undefined index: email in /in/VYlYj on line 6 Fatal error: Call to undefined function mysql_query() in /in/VYlYj on line 8
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/VYlYj on line 4 Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/VYlYj on line 4 Notice: Undefined index: email in /in/VYlYj on line 6 Fatal error: Call to undefined function mysql_query() in /in/VYlYj on line 8
Process exited with code 255.
Output for 5.1.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/VYlYj on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/VYlYj:2) in /in/VYlYj on line 2 Warning: include_once(db.php): failed to open stream: No such file or directory in /in/VYlYj on line 4 Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/VYlYj on line 4 Notice: Undefined index: email in /in/VYlYj on line 6 Fatal error: Call to undefined function mysql_query() in /in/VYlYj on line 8
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: session_start(): Cannot send session cookie - headers already sent in /in/VYlYj on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/VYlYj:2) in /in/VYlYj on line 2 Warning: main(db.php): failed to open stream: No such file or directory in /in/VYlYj on line 4 Warning: main(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/VYlYj on line 4 Notice: Undefined index: email in /in/VYlYj on line 6 Fatal error: Call to undefined function mysql_query() in /in/VYlYj on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: session_start(): Cannot send session cookie - headers already sent in /in/VYlYj on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/VYlYj:2) in /in/VYlYj on line 2 Warning: main(db.php): failed to open stream: No such file or directory in /in/VYlYj on line 4 Warning: main(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/VYlYj on line 4 Notice: Undefined index: email in /in/VYlYj on line 6 Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/VYlYj on line 8 Warning: mysql_query(): A link to the server could not be established in /in/VYlYj on line 8 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
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/VYlYj on line 2 Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/VYlYj:2) in /in/VYlYj on line 2 Warning: main(db.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/VYlYj on line 4 Warning: main() [http://www.php.net/function.main]: Failed opening 'db.php' for inclusion (include_path='.:') in /in/VYlYj on line 4 Notice: Undefined index: email in /in/VYlYj on line 6 Warning: mysql_query() [http://www.php.net/function.mysql-query]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/VYlYj on line 8 Warning: mysql_query() [http://www.php.net/function.mysql-query]: A link to the server could not be established in /in/VYlYj on line 8 Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)