Commit 9ffbf54284aceb720ac479829a0bcfc0ba0c6e1a

Authored by Neil Blakey-Milner
1 parent c38b9670

Check session verification against boolean true using type checking.

Also, set expire to integer 0, not boolean false, in case that's the
source of a PHP5-related bug.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5449 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 5 additions and 3 deletions
login.php
@@ -41,7 +41,8 @@ class LoginPageDispatcher extends KTDispatcher { @@ -41,7 +41,8 @@ class LoginPageDispatcher extends KTDispatcher {
41 function check() { 41 function check() {
42 $oKTConfig = KTConfig::getSingleton(); 42 $oKTConfig = KTConfig::getSingleton();
43 $this->session = new Session(); 43 $this->session = new Session();
44 - if ($this->session->verify() == 1) { // the session is valid 44 + $sessionStatus = $this->session->verify();
  45 + if ($sessionStatus === true) { // the session is valid
45 if ($_SESSION['userID'] == -2 && $oKTConfig->get('allowAnonymousLogin', false)) { 46 if ($_SESSION['userID'] == -2 && $oKTConfig->get('allowAnonymousLogin', false)) {
46 ; // that's ok - we want to login. 47 ; // that's ok - we want to login.
47 } 48 }
@@ -54,7 +55,8 @@ class LoginPageDispatcher extends KTDispatcher { @@ -54,7 +55,8 @@ class LoginPageDispatcher extends KTDispatcher {
54 55
55 function do_providerVerify() { 56 function do_providerVerify() {
56 $this->session = new Session(); 57 $this->session = new Session();
57 - if ($this->session->verify() != 1) { 58 + $sessionStatus = $this->session->verify();
  59 + if ($sessionStatus !== true) { // the session is not valid
58 $this->redirectToMain(); 60 $this->redirectToMain();
59 } 61 }
60 $this->oUser =& User::get($_SESSION['userID']); 62 $this->oUser =& User::get($_SESSION['userID']);
@@ -164,7 +166,7 @@ class LoginPageDispatcher extends KTDispatcher { @@ -164,7 +166,7 @@ class LoginPageDispatcher extends KTDispatcher {
164 $_SESSION["pageAccess"] = NULL; 166 $_SESSION["pageAccess"] = NULL;
165 167
166 $cookietest = KTUtil::randomString(); 168 $cookietest = KTUtil::randomString();
167 - setcookie("CookieTestCookie", $cookietest, false); 169 + setcookie("CookieTestCookie", $cookietest, 0);
168 170
169 $this->redirectTo('checkCookie', array( 171 $this->redirectTo('checkCookie', array(
170 'cookieVerify' => $cookietest, 172 'cookieVerify' => $cookietest,