RE: starting session with AJAX
| From: | John Pillion | Date: | Sat, 29 Aug 2009 19:22:47 +0000 |
| Subject: | RE: starting session with AJAX | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-297482@lists.php.net to get a copy of this message | ||
I found two small errors in the isLoggedIn(), which are corrected below.
They don't have any effect on the issue at hand though.
**************************
function isLoggedIn($debug = 0){
global $COOKIE_NAME;
// if there is an active session.
if (isset($_SESSION) && $_SESSION['sessDBID'] != '' &&
$_SESSION['sessKey']
!= ""){
//. check the contents
return authenticate($_SESSION['sessDBID'], $_SESSION['sessKey']);
// or, check for (persistent) cookie.
}elseif (isset($_COOKIE[$COOKIE_NAME]) && $_COOKIE[$COOKIE_NAME] != ""){
$sessInfo = split('-', $_COOKIE[$COOKIE_NAME]);
// . and check the contents
if(authenticate($sessInfo[0], $sessInfo[1], $debug)){
// reset the cookie
return (mySessionStart(true, $sessInfo[0], $sessInfo[1], $debug));
}else{
// cookie authentication failed
return false;
}
}else{
// there is no session or cookie
return false;
}
}