file deleteattempts.html was added on branch MOODLE_15_STABLE on 2005-07-07 16:14...
[moodle.git] / login / logout.php
blob0fac4d3dc22f7c3b994629390df4d8e4a107d880
1 <?php // $Id$
2 // Logs the user out and sends them to the home page
4 require_once("../config.php");
6 if (isset($USER) and isset($USER->id)) {
7 add_to_log(SITEID, "user", "logout", "view.php?id=$USER->id&course=".SITEID, $USER->id, 0, $USER->id);
9 if ($USER->auth == 'cas' && !empty($CFG->cas_enabled)) {
10 require($CFG->dirroot.'/auth/cas/logout.php');
15 if (ini_get_bool("register_globals") and check_php_version("4.3.0")) {
16 // This method is just to try to avoid silly warnings from PHP 4.3.0
17 session_unregister("USER");
18 session_unregister("SESSION");
21 setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, '/');
22 unset($_SESSION['USER']);
23 unset($_SESSION['SESSION']);
25 unset($SESSION);
26 unset($USER);
28 redirect("$CFG->wwwroot/");