root/releases/0.1.1b/units/users/function_log_off.php
| Revision 2, 503 bytes (checked in by sven, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | |
| 3 | // Function to log off |
| 4 | |
| 5 | // Are userid and usercode set? |
| 6 | |
| 7 | if (isset($_SESSION['userid']) & isset($_SESSION['usercode'])) { |
| 8 | |
| 9 | // Then set the usercode to blank |
| 10 | |
| 11 | $userid = (int) $_SESSION['userid']; |
| 12 | db_query("update users set code = '' where ident = '$userid'"); |
| 13 | |
| 14 | } |
| 15 | |
| 16 | // Set the session variables to blank |
| 17 | |
| 18 | unset($_SESSION['userid']); |
| 19 | unset($_SESSION['usercode']); |
| 20 | |
| 21 | // Set headers to forward to main URL |
| 22 | |
| 23 | header("Location: " . url . "\n"); |
| 24 | |
| 25 | ?> |
Note: See TracBrowser for help on using the browser.
