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']);
28 redirect("$CFG->wwwroot/");