diff --git a/lib/control.inc b/lib/control.inc index a7e2338..2d43df6 100644 --- a/lib/control.inc +++ b/lib/control.inc @@ -69,25 +69,26 @@ function generateLink($action) { function checkSession() { global $default; - session_start(); $session = new Session(); $sessionStatus = $session->verify(); - // ??: do i need all this stuff? + if ($sessionStatus["status"] != 1) { // verification failed, redirect to login with error message + $default->log->debug("checkSession:: session check failed"); $url = "/login.php?loginAction=loginForm"; $redirect = $_SERVER[PHP_SELF]; - //echo "redirect url = $redirect
"; if (strlen($redirect) > 1) { - // not redirecting to login, so this session verification failure - // represents either the first visit to the site - // OR a session timeout etc. (in which case we still want to bounce + $default->log->debug("checkSession:: redirect url=$redirect"); + // this session verification failure represents either the first visit to + // the site OR a session timeout etc. (in which case we still want to bounce // the user to the login page, and then back to whatever page they're on now) $url = $url . "&redirect=" . $redirect; } + $default->log->debug("checkSession:: about to redirect to $url"); redirect($url); } else { + $default->log->debug("checkSession:: returning true"); return true; } }