-
Notifications
You must be signed in to change notification settings - Fork 2
/
adminaccedit.php
108 lines (89 loc) · 4.08 KB
/
adminaccedit.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/*
Ceres Control Panel
This is a control pannel program for Athena and Freya
Copyright (C) 2005 by Beowulf and Nightroad
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
To contact any of the authors about special permissions send
an e-mail to cerescp@gmail.com
*/
session_start();
include_once 'config.php'; // loads config variables
include_once 'query.php'; // imports queries
include_once 'adminquery.php';
include_once 'functions.php';
if (!isset($_SESSION[$CONFIG_name.'level']) || $_SESSION[$CONFIG_name.'level'] < $CONFIG['cp_admin'])
die ("Not Authorized");
if (isset($GET_frm_name) && isset($GET_id)) {
if (notnumber($GET_id) || inject($GET_login) || inject($GET_password) || inject($GET_email))
alert($lang['INCORRECT_CHARACTER']);
$query = sprintf(ACCOUNTS_SEARCH_ACCOUNT_ID, trim($GET_id));
$result = execute_query($query, 'adminaccedit.php');
if ($line = $result->fetch_row()) {
if ($GET_sex != 'M' && $GET_sex != 'F')
$GET_sex = $line[2];
if ($GET_level > 99 || $GET_level < 0)
$GET_level = $line[4];
if ($_SESSION[$CONFIG_name.'level'] <= $line[4] || ($GET_level >= $_SESSION[$CONFIG_name.'level'] && $_SESSION[$CONFIG_name.'level'] != 99))
$GET_level = $line[4];
$query = sprintf(ACCEDIT_UPDATE, $GET_login, $GET_password, $GET_sex, $GET_email, $GET_level, trim($GET_id));
$result = execute_query($query, 'adminaccedit.php');
alert("Account Updated");
}
}
opentable("Account Edit");
if (isset($GET_back)) {
$back = base64_decode($GET_back);
echo "<span title=\"Back\" style=\"cursor:pointer\" onMouseOver=\"this.style.color='#FF3300'\" onMouseOut=\"this.style.color='#000000'\" onClick=\"return LINK_ajax('adminaccounts.php?$back','accounts_div');\"><-back</span>";
}
if (isset($GET_id)) {
$query = sprintf(ACCOUNTS_SEARCH_ACCOUNT_ID, trim($GET_id));
$result = execute_query($query, 'adminaccedit.php');
if ($line = $result->fetch_row()) {
$sex = $line[2];
echo "
<form id=\"accedit\" onSubmit=\"return GET_ajax('adminaccedit.php','accounts_div','accedit');\">
<table width=\"500\">
<tr>
<td align=\"right\">Account_id</td><td align=\"left\">$line[0]<input type=\"hidden\" name=\"id\" value=\"$line[0]\"></td>
</tr><tr>
<td align=\"right\">Login</td><td align=\"left\"><input type=\"text\" name=\"login\" value=\"$line[1]\" maxlength=\"23\" size=\"23\"></td>
</tr><tr>
<td align=\"right\">Password</td><td align=\"left\"><input type=\"text\" name=\"password\" value=\"$line[8]\" maxlength=\"32\" size=\"23\"></td>
</tr><tr>
<td align=\"right\">Sex</td>
<td align=\"left\">
<select name=\"sex\">
";
if (strcmp($line[2], 'M'))
echo "<option value=\"M\">".$lang['SEX_MALE']."<option selected value=\"F\">".$lang['SEX_FEMALE'];
else
echo "<option selected value=\"M\">".$lang['SEX_MALE']."<option value=\"F\">".$lang['SEX_FEMALE'];
echo "
</select>
</td>
</tr><tr>
<td align=\"right\">Email</td><td align=\"left\"><input type=\"text\" name=\"email\" value=\"$line[3]\" maxlength=\"60\" size=\"23\"></td>
</tr><tr>
<td align=\"right\">Level</td><td align=\"left\"><input type=\"text\" name=\"level\" value=\"$line[4]\" maxlength=\"2\" size=\"2\"></td>
</tr><tr>
<td> </td><td align=\"left\"><input type=\"submit\" value=\"".$lang['CHANGEMAIL_CHANGE']."\">
</td></tr>
</table>
</form>
";
}
} else echo "Not Found";
closetable();
fim();
?>