Removing/clearing JQuery cookie upon logout
How can I make certain the "accordion" cookie is completely removed when the user logs out?
Here's where the cookie is set:
-
var accordion = $("#accordion");
var index = $.cookie("accordion");
var active;
if (index !== null) {
active = accordion.find("h3:eq(" + index + ")");
} else {
active = 0
}
accordion.accordion({
header: "h3",
event: "click hoverintent",
active: active,
change: function(event, ui) {
var index = $(this).find("h3").index ( ui.newHeader[0] );
$.cookie("accordion", index, {
path: "/"
});
},
autoHeight: false
});
And here's the existing logout page:
-
<?php
if ( !defined( 'SMARTY_DIR' ) ) {
include_once( 'init.php' );
}
$osDB->query( 'DELETE FROM ! WHERE userid = ?', array( ONLINE_USERS_TABLE, $_SESSION['UserId'] ) );
$osDB->disconnect();
session_destroy();
setcookie($config['cookie_prefix']."site_info[username]", $cookie['username'], strtotime("-1day"), "/" );
setcookie($config['cookie_prefix']."site_info[dir]", $cookie['dir'], strtotime("-1day"), "/" );
unset( $_COOKIE[$config['cookie_prefix'].'site_info'] );
unset( $cookie );
unset( $_SESSION );
header('location: index.php');
exit;
?>