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;
}
}