<?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!";
}
} elseif($_GET['id']) {
$msg_id = $_GET['id'];
$gid = $_GET['gid'];
$query4author = mysql_query("SELECT * FROM groupmessages WHERE author = '$user_id' AND msg_id = '$msg_id'");
$post = mysql_fetch_array($query4author);
$author = mysql_num_rows($query4author);
$query4admin = mysql_query("SELECT * FROM groups WHERE id = '$gid' AND admin = '$user_id' AND active = '1'");
$admin = mysql_num_rows($query4admin);
$query = mysql_query("SELECT * FROM groupmessages WHERE msg_id = '$msg_id'");
$info = mysql_fetch_array($query);
$uid = $info['author'];
if($author==1){
mysql_query("DELETE FROM `groupmessages` WHERE author = '$uid' AND msg_id='$msg_id'") or die(mysql_error());
header('Location: /groups/?id='.$gid.'&msg=The post has been deleted!');
} elseif($admin==1){
$msg = "<i>This post was deleted by admin</i>";
mysql_query("UPDATE groupmessages SET message = '$msg' WHERE author ='$uid' AND msg_id ='$msg_id'") or die("Error occured!");
header('Location: /groups/?id='.$gid.'&msg=The post has been deleted!');
} else {
echo "<b>You are not author!</b>";
}
}
?>
Warning: include_once(): open_basedir restriction in effect. File(db.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/ofK7X on line 4
Warning: include_once(db.php): Failed to open stream: Operation not permitted in /in/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Warning: Undefined array key "email" in /in/ofK7X on line 6
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/ofK7X:8
Stack trace:
#0 {main}
thrown in /in/ofK7X on line 8
Process exited with code 255.
Output for 8.0.13
Warning: include_once(db.php): Failed to open stream: No such file or directory in /in/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Warning: Undefined array key "email" in /in/ofK7X on line 6
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/ofK7X:8
Stack trace:
#0 {main}
thrown in /in/ofK7X on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0, 7.4.33
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X on line 6
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/ofK7X:8
Stack trace:
#0 {main}
thrown in /in/ofK7X on line 8
Process exited with code 255.
Warning: include_once(): open_basedir restriction in effect. File(db.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/ofK7X on line 4
Warning: include_once(db.php): failed to open stream: Operation not permitted in /in/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X on line 6
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/ofK7X:8
Stack trace:
#0 {main}
thrown in /in/ofK7X on line 8
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/ofK7X:8
Stack trace:
#0 {main}
thrown in /in/ofK7X on line 8
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/ofK7X on line 4
Warning: include_once(db.php): failed to open stream: Operation not permitted in /in/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X on line 6
Fatal error: Uncaught Error: Call to undefined function mysql_query() in /in/ofK7X:8
Stack trace:
#0 {main}
thrown in /in/ofK7X on line 8
Process exited with code 255.
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X on line 6
Fatal error: Call to undefined function mysql_query() in /in/ofK7X 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/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X on line 6
Fatal error: Call to undefined function mysql_query() in /in/ofK7X on line 8
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/ofK7X on line 2
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/ofK7X:2) in /in/ofK7X on line 2
Warning: include_once(db.php): failed to open stream: No such file or directory in /in/ofK7X on line 4
Warning: include_once(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X on line 6
Fatal error: Call to undefined function mysql_query() in /in/ofK7X 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/ofK7X on line 2
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/ofK7X:2) in /in/ofK7X on line 2
Warning: main(db.php): failed to open stream: No such file or directory in /in/ofK7X on line 4
Warning: main(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X on line 6
Fatal error: Call to undefined function mysql_query() in /in/ofK7X on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Warning: session_start(): Cannot send session cookie - headers already sent in /in/ofK7X on line 2
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/ofK7X:2) in /in/ofK7X on line 2
Warning: main(db.php): failed to open stream: No such file or directory in /in/ofK7X on line 4
Warning: main(): Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X on line 6
Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /in/ofK7X on line 8
Warning: mysql_query(): A link to the server could not be established in /in/ofK7X 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/ofK7X 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/ofK7X:2) in /in/ofK7X on line 2
Warning: main(db.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/ofK7X on line 4
Warning: main() [http://www.php.net/function.main]: Failed opening 'db.php' for inclusion (include_path='.:') in /in/ofK7X on line 4
Notice: Undefined index: email in /in/ofK7X 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/ofK7X on line 8
Warning: mysql_query() [http://www.php.net/function.mysql-query]: A link to the server could not be established in /in/ofK7X on line 8
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)