Rev 45 | Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 32 | tom | 1 | <?php |
| 2 | |||
| 3 | require '_taios.php'; |
||
| 4 | |||
| 5 | $page = new Taios_Page('Update Account'); |
||
| 6 | $userID = $page->getPostID(); |
||
| 7 | |||
| 8 | $page->checkLoggedIn(); |
||
| 9 | |||
| 10 | $accessID = $_POST['accessID']; |
||
| 11 | $password = $_POST['password']; |
||
| 12 | $email = $_POST['email']; |
||
| 13 | $name = $_POST['name']; |
||
| 14 | |||
| 15 | $user = $page->getUserByID($userID); |
||
| 16 | if (($page->getLoggedInUser()->ID == $userID || $page->isUserAdmin($page->getLoggedInUser())) && $user) |
||
| 17 | { |
||
| 18 | if (isset($accessID) && $page->isUserAdmin($page->getLoggedInUser())) |
||
| 19 | { |
||
| 20 | $page->query('UPDATE Users SET AccessID=' . $accessID . ' WHERE ID = ' . $userID); |
||
| 21 | } |
||
| 22 | |||
| 23 | if (!empty($password)) |
||
| 24 | { |
||
| 25 | $page->query('UPDATE Users SET Password=' . sha1($password) . ' WHERE ID = ' . $userID); |
||
| 26 | } |
||
| 27 | } |
||
| 28 | else |
||
| 29 | { |
||
| 30 | if (!$user) |
||
| 31 | { |
||
| 32 | drawError('No such user, #' . $userID); |
||
| 33 | } |
||
| 34 | else |
||
| 35 | { |
||
| 36 | drawError('You do not have permission to access this page.'); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | $page->redirect('account.php?id=' . $id); |
||
| 41 | |||
| 42 | ?> |