http://www.atutor.ca/atutor/mantis/view.php?id=2522
authorjoel kronenberg <joel.kronenberg@utoronto.ca>
Tue, 20 Jun 2006 18:33:44 +0000 (18:33 -0000)
committerjoel kronenberg <joel.kronenberg@utoronto.ca>
Tue, 20 Jun 2006 18:33:44 +0000 (18:33 -0000)
docs/login.php

index 74ad9c6..0e6c419 100644 (file)
 /****************************************************************/
 // $Id$
 
-$page   = 'login';
 $_user_location        = 'public';
 define('AT_INCLUDE_PATH', 'include/');
 require (AT_INCLUDE_PATH.'vitals.inc.php');
 
-
-if (isset($_POST['cancel'])) {
-       header('Location: about.php');
-       exit;
-}
-
 if (isset($_GET['course'])) {
        $_GET['course'] = intval($_GET['course']);
 } else {
@@ -40,7 +33,7 @@ if (!$msg->containsFeedbacks()) {
 }
 
 if (!isset($_SESSION['token']) || !$_SESSION['token']) {
-       $_SESSION['token'] = md5(mt_rand());
+       $_SESSION['token'] = sha1(mt_rand());
 }
 
 if (isset($cookie_login, $cookie_pass) && !isset($_POST['submit'])) {
@@ -63,7 +56,7 @@ if (isset($cookie_login, $cookie_pass) && !isset($_POST['submit'])) {
        $used_cookie    = false;
 }
 
-if (isset($this_login, $this_password) && !isset($_SESSION['token'])) {
+if (isset($this_login, $this_password) && !isset($_SESSION['session_test'])) {
        $msg->addError('SESSION_COOKIES');
 } else if (isset($this_login, $this_password)) {
        if (version_compare(PHP_VERSION, '5.1.0', '>=')) {
@@ -140,6 +133,8 @@ if (isset($this_login, $this_password) && !isset($_SESSION['token'])) {
        }
 }
 
+$_SESSION['session_test'] = TRUE;
+
 if (isset($_SESSION['member_id'])) {
        $sql = "DELETE FROM ".TABLE_PREFIX."users_online WHERE member_id=$_SESSION[member_id]";
        $result = @mysql_query($sql, $db);