-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuserLookup.php
88 lines (59 loc) · 1.97 KB
/
userLookup.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<html>
<?php
include('globalsetup.php');
setupHeader();
$username = $_GET['uname'];
if(isset($_POST['editUsername'])) {
$username = $_POST['editUsername'];
submitUpdates();
closeAndReloadParent();
}
showUserDetail($username);
function submitUpdates() {
$editName = addslashes($_POST['editName']);
$editUsername = addslashes($_POST['editUsername']);
//Detect troublemakers
$editIsAdmin = $_POST['editIsAdmin'];
if(!isset($editIsAdmin)) {$editIsAdmin = 0;}
$editIsResident = $_POST['editIsResident'];
if(!isset($editIsResident)) {$editIsResident = 0;}
editUser($editName, $editUsername, $editIsAdmin, $editIsResident);
}
function showUserDetail($un) {
global $isAdmin;
//Get the user's data
$result = getUser($un);
while($row = mysql_fetch_array($result))
{
print "<div class='popupText'>";
if($isAdmin >= 1) {
print '<form name="input" action="userLookup.php" method="post">';
}
echo "<b>Username:</b> <br/>" . $row['username'] . "<br/>";
$_POST['editName'] = $row['name'];
$_POST['editUsername'] = $row['username'];
if(!$isAdmin) {
echo "<b>Name:</b> <br/>" . $row['name'] . "<br/>";
echo "<b>Admin?</b> <br/>" . getBinaryImage($row['isAdmin']) . "<br/>";
echo "<b>Simmons Resident?</b> <br/>" . getBinaryImage($row['isResident']) . "<br/>";
} else {
echo'<b>Name: </b><br/>';
echo ' <input title="Name: " id="editName" name="editName" type="text" value="' .
$row['name'] . '" /><br/>';
echo "<b>Admin?</b> <br/>" . getCheckboxText("editIsAdmin", $row['isAdmin']) . "<br/>";
echo "<b>Simmons Resident?</b> <br/>" .
getCheckboxText("editIsResident", $row['isResident']) . "<br/>";
echo '<input type="hidden" name="editUsername" value="' . $row['username'] . '" />';
}
}
if($isAdmin >= 1) {
echo '<input type="submit" value="Submit Changes">
</form> ';
} else {
print '<br/>
<a href="javascript:self.close()">Close</a>';
}
print("</div>");
}
?>
</html>