Commit 0c43a0ce498303b11350c96352f32630e281a1fe

Authored by michael
1 parent 4b504238

added debug logging

moved session_start to Session class


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@192 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 7 additions and 6 deletions
lib/control.inc
@@ -69,25 +69,26 @@ function generateLink($action) { @@ -69,25 +69,26 @@ function generateLink($action) {
69 function checkSession() { 69 function checkSession() {
70 global $default; 70 global $default;
71 71
72 - session_start();  
73 $session = new Session(); 72 $session = new Session();
74 $sessionStatus = $session->verify(); 73 $sessionStatus = $session->verify();
75 - // ??: do i need all this stuff? 74 +
76 if ($sessionStatus["status"] != 1) { 75 if ($sessionStatus["status"] != 1) {
77 // verification failed, redirect to login with error message 76 // verification failed, redirect to login with error message
  77 + $default->log->debug("checkSession:: session check failed");
78 $url = "/login.php?loginAction=loginForm"; 78 $url = "/login.php?loginAction=loginForm";
79 79
80 $redirect = $_SERVER[PHP_SELF]; 80 $redirect = $_SERVER[PHP_SELF];
81 - //echo "redirect url = $redirect<br>";  
82 if (strlen($redirect) > 1) { 81 if (strlen($redirect) > 1) {
83 - // not redirecting to login, so this session verification failure  
84 - // represents either the first visit to the site  
85 - // OR a session timeout etc. (in which case we still want to bounce 82 + $default->log->debug("checkSession:: redirect url=$redirect");
  83 + // this session verification failure represents either the first visit to
  84 + // the site OR a session timeout etc. (in which case we still want to bounce
86 // the user to the login page, and then back to whatever page they're on now) 85 // the user to the login page, and then back to whatever page they're on now)
87 $url = $url . "&redirect=" . $redirect; 86 $url = $url . "&redirect=" . $redirect;
88 } 87 }
  88 + $default->log->debug("checkSession:: about to redirect to $url");
89 redirect($url); 89 redirect($url);
90 } else { 90 } else {
  91 + $default->log->debug("checkSession:: returning true");
91 return true; 92 return true;
92 } 93 }
93 } 94 }