-
Notifications
You must be signed in to change notification settings - Fork 0
/
userDelete.php
47 lines (36 loc) · 950 Bytes
/
userDelete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require_once('includes/globals.inc');
if(isset($_GET['name']))
{
$name = $_GET['name'];
emitTop('Peanut Butter -> Delete User: '.$name, '/pb/');
}
else
{
emitTop('Peanut Butter -> Delete User [ERROR]', $_SERVER['PHP_SELF']);
print('<h3>Required information not specified.</h3>');
emitBottom();
die();
}
if($userType != SITEADMIN)
{
print('<h3>Sorry, only siteadmins may delete users.</h3>');
emitBottom();
die();
}
if(isset($_GET['confirmed']))
{
mysqlSetup();
$mname = mysql_escape_string($name);
$sqlquery = "DELETE FROM `pb_users` WHERE `name` = '$mname'";
$result = mysql_query($sqlquery) or die('Invalid query: ' . mysql_error());
print('<h3>User Deleted.</h3>');
print("<p><a href=\"accountManagement.php\">Back to Account Management</a></p>");
}
else
{
$urlname = urlencode($name);
print("<p><a href=\"".$_SERVER['PHP_SELF']."?name=$urlname&confirmed=1\">Delete user '$name'.</a></p>");
}
emitBottom();
?>