-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_account.php
246 lines (220 loc) · 13.6 KB
/
admin_account.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
/*
Copyright (c) 2002 - 2005 SystemsManager.Net
SystemsManager Technologies
oscMall System Version 4
http://www.systemsmanager.net
Portions Copyright (c) 2002 osCommerce
This source file is subject to version 2.0 of the GPL license,
that is bundled with this package in the file LICENSE. If you
did not receive a copy of the oscMall System license and are unable
to obtain it through the world-wide-web, please send a note to
license@systemsmanager.net so we can mail you a copy immediately.
*/
require('includes/application_top.php');
$current_boxes = DIR_FS_ADMIN . DIR_WS_BOXES;
if ($HTTP_GET_VARS['action']) {
switch ($HTTP_GET_VARS['action']) {
case 'check_password':
$check_pass_query = smn_db_query("select admin_password as confirm_password from " . TABLE_ADMIN . " where admin_id = '" . $HTTP_POST_VARS['id_info'] . "'");
$check_pass = smn_db_fetch_array($check_pass_query);
// Check that password is good
if (!smn_validate_password($HTTP_POST_VARS['password_confirmation'], $check_pass['confirm_password'])) {
smn_redirect(smn_href_link(FILENAME_ADMIN_ACCOUNT, 'action=check_account&error=password'));
} else {
//$confirm = 'confirm_account';
smn_session_register('confirm_account');
smn_redirect(smn_href_link(FILENAME_ADMIN_ACCOUNT, 'action=edit_process'));
}
break;
case 'save_account':
$admin_id = smn_db_prepare_input($HTTP_POST_VARS['id_info']);
$admin_email_address = smn_db_prepare_input($HTTP_POST_VARS['admin_email_address']);
$stored_email[] = 'NONE';
$check_email_query = smn_db_query("select admin_email_address from " . TABLE_ADMIN . " where admin_id <> " . $admin_id . "");
while ($check_email = smn_db_fetch_array($check_email_query)) {
$stored_email[] = $check_email['admin_email_address'];
}
if (in_array($HTTP_POST_VARS['admin_email_address'], $stored_email)) {
smn_redirect(smn_href_link(FILENAME_ADMIN_ACCOUNT, 'action=edit_process&error=email'));
} else {
$sql_data_array = array('admin_firstname' => smn_db_prepare_input($HTTP_POST_VARS['admin_firstname']),
'admin_lastname' => smn_db_prepare_input($HTTP_POST_VARS['admin_lastname']),
'admin_email_address' => smn_db_prepare_input($HTTP_POST_VARS['admin_email_address']),
'admin_password' => smn_encrypt_password(smn_db_prepare_input($HTTP_POST_VARS['admin_password'])),
'admin_modified' => 'now()');
smn_db_perform(TABLE_ADMIN, $sql_data_array, 'update', 'admin_id = \'' . $admin_id . '\'');
smn_mail($HTTP_POST_VARS['admin_firstname'] . ' ' . $HTTP_POST_VARS['admin_lastname'], $HTTP_POST_VARS['check_email_address'], ADMIN_EMAIL_SUBJECT, sprintf(ADMIN_EMAIL_TEXT, $hiddenPassword), $HTTP_POST_VARS['check_firstname'] . ' ' . $HTTP_POST_VARS['admin_lastname'], $HTTP_POST_VARS['check_email_address']);
smn_redirect(smn_href_link(FILENAME_ADMIN_ACCOUNT, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $admin_id));
}
break;
}
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
<?php require('includes/account_check.js.php'); ?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top">
<?php if ($HTTP_GET_VARS['action'] == 'edit_process') { echo smn_draw_form('account', FILENAME_ADMIN_ACCOUNT, 'action=save_account', 'post', 'enctype="multipart/form-data"'); } elseif ($HTTP_GET_VARS['action'] == 'check_account') { echo smn_draw_form('account', FILENAME_ADMIN_ACCOUNT, 'action=check_password', 'post', 'enctype="multipart/form-data"'); } else { echo smn_draw_form('account', FILENAME_ADMIN_ACCOUNT, 'action=check_account', 'post', 'enctype="multipart/form-data"'); } ?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo smn_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top">
<?php
$my_account_query = smn_db_query ("select a.admin_id, a.admin_firstname, a.admin_lastname, a.admin_email_address, a.admin_created, a.admin_modified, a.admin_logdate, a.admin_lognum, g.admin_groups_name from " . TABLE_ADMIN . " a, " . TABLE_ADMIN_GROUPS . " g where a.admin_id= " . $login_id . " and g.admin_groups_id= " . $login_groups_id . "");
$myAccount = smn_db_fetch_array($my_account_query);
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2" align="center">
<tr class="dataTableHeadingRow">
<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_ACCOUNT; ?>
</td>
</tr>
<tr class="dataTableRow">
<td>
<table border="0" cellspacing="0" cellpadding="3">
<?php
if ( ($HTTP_GET_VARS['action'] == 'edit_process') && (smn_session_is_registered('confirm_account')) ) {
?>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_FIRSTNAME; ?> </nobr></td>
<td class="dataTableContent"><?php echo smn_draw_input_field('admin_firstname', $myAccount['admin_firstname']); ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_LASTNAME; ?> </nobr></td>
<td class="dataTableContent"><?php echo smn_draw_input_field('admin_lastname', $myAccount['admin_lastname']); ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_EMAIL; ?> </nobr></td>
<td class="dataTableContent"><?php if ($HTTP_GET_VARS['error']) { echo smn_draw_input_field('admin_email_address', $myAccount['admin_email_address']) . ' <nobr>' . TEXT_INFO_ERROR . '</nobr>'; } else { echo smn_draw_input_field('admin_email_address', $myAccount['admin_email_address']); } ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_PASSWORD; ?> </nobr></td>
<td class="dataTableContent"><?php echo smn_draw_password_field('admin_password'); ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_PASSWORD_CONFIRM; ?> </nobr></td>
<td class="dataTableContent"><?php echo smn_draw_password_field('admin_password_confirm'); ?></td>
</tr>
<?php
} else {
if (smn_session_is_registered('confirm_account')) {
smn_session_unregister('confirm_account');
}
?>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_FULLNAME; ?> </nobr></td>
<td class="dataTableContent"><?php echo $myAccount['admin_firstname'] . ' ' . $myAccount['admin_lastname']; ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_EMAIL; ?> </nobr></td>
<td class="dataTableContent"><?php echo $myAccount['admin_email_address']; ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_PASSWORD; ?> </nobr></td>
<td class="dataTableContent"><?php echo TEXT_INFO_PASSWORD_HIDDEN; ?></td>
</tr>
<tr class="dataTableRowSelected">
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_GROUP; ?> </nobr></td>
<td class="dataTableContent"><?php echo $myAccount['admin_groups_name']; ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_CREATED; ?> </nobr></td>
<td class="dataTableContent"><?php echo $myAccount['admin_created']; ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_LOGNUM; ?> </nobr></td>
<td class="dataTableContent"><?php echo $myAccount['admin_lognum']; ?></td>
</tr>
<tr>
<td class="dataTableContent"><nobr><?php echo TEXT_INFO_LOGDATE; ?> </nobr></td>
<td class="dataTableContent"><?php echo $myAccount['admin_logdate']; ?></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="3"><tr><td class="smallText" valign="top"><?php echo TEXT_INFO_MODIFIED . $myAccount['admin_modified']; ?></td><td align="right"><?php if ($HTTP_GET_VARS['action'] == 'edit_process') { echo '<a href="' . smn_href_link(FILENAME_ADMIN_ACCOUNT) . '">' . smn_image_button('button_back.gif', IMAGE_BACK) . '</a> '; if (smn_session_is_registered('confirm_account')) { echo smn_image_submit('button_save.gif', IMAGE_SAVE, 'onClick="validateForm();return document.returnValue"'); } } elseif ($HTTP_GET_VARS['action'] == 'check_account') { echo ' '; } else { echo smn_image_submit('button_edit.gif', IMAGE_EDIT); } ?></td><tr></table></td>
</tr>
</table>
</td>
<?php
$heading = array();
$contents = array();
switch ($HTTP_GET_VARS['action']) {
case 'edit_process':
$heading[] = array('text' => '<b> ' . TEXT_INFO_HEADING_DEFAULT . '</b>');
$contents[] = array('text' => TEXT_INFO_INTRO_EDIT_PROCESS . smn_draw_hidden_field('id_info', $myAccount['admin_id']));
//$contents[] = array('align' => 'center', 'text' => '<a href="' . smn_href_link(FILENAME_ADMIN_ACCOUNT) . '">' . smn_image_button('button_back.gif', IMAGE_BACK) . '</a> ' . smn_image_submit('button_confirm.gif', IMAGE_CONFIRM, 'onClick="validateForm();return document.returnValue"') . '<br> ');
break;
case 'check_account':
$heading[] = array('text' => '<b> ' . TEXT_INFO_HEADING_CONFIRM_PASSWORD . '</b>');
$contents[] = array('text' => ' ' . TEXT_INFO_INTRO_CONFIRM_PASSWORD . smn_draw_hidden_field('id_info', $myAccount['admin_id']));
if ($HTTP_GET_VARS['error']) {
$contents[] = array('text' => ' ' . TEXT_INFO_INTRO_CONFIRM_PASSWORD_ERROR);
}
$contents[] = array('align' => 'center', 'text' => smn_draw_password_field('password_confirmation'));
$contents[] = array('align' => 'center', 'text' => '<a href="' . smn_href_link(FILENAME_ADMIN_ACCOUNT) . '">' . smn_image_button('button_back.gif', IMAGE_BACK) . '</a> ' . smn_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '<br> ');
break;
default:
$heading[] = array('text' => '<b> ' . TEXT_INFO_HEADING_DEFAULT . '</b>');
$contents[] = array('text' => TEXT_INFO_INTRO_DEFAULT);
//$contents[] = array('align' => 'center', 'text' => smn_image_submit('button_edit.gif', IMAGE_EDIT) . '<br> ');
if ($myAccount['admin_email_address'] == 'admin@localhost') {
$contents[] = array('text' => sprintf(TEXT_INFO_INTRO_DEFAULT_FIRST, $myAccount['admin_firstname']) . '<br> ');
} elseif (($myAccount['admin_modified'] == '0000-00-00 00:00:00') || ($myAccount['admin_logdate'] <= 1) ) {
$contents[] = array('text' => sprintf(TEXT_INFO_INTRO_DEFAULT_FIRST_TIME, $myAccount['admin_firstname']) . '<br> ');
}
}
if ( (smn_not_null($heading)) && (smn_not_null($contents)) ) {
echo ' <td width="25%" valign="top">' . "\n";
$box = new box;
echo $box->infoBox($heading, $contents);
echo ' </td>' . "\n";
}
?>
</tr>
</table></td>
</tr>
</table></form></td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>