Changeset 1450

Show
Ignore:
Timestamp:
04/24/06 17:33:25 (3 years ago)
Author:
mbonetti
Message:

experimental: only check for a valid IP when we actual log in. Should fix
the can't log in from distinct IPs bug

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/rss/cls/user.php

    r1449 r1450  
    2727############################################################################### 
    2828rss_require('cls/wrappers/user.php'); 
     29 
     30define ('RSS_USER_ACTION_LOGIN',0x01); 
     31define ('RSS_USER_ACTION_COOKIE',0x02); 
     32define ('RSS_USER_ACTION_SESSION',0x04); 
     33define ('RSS_USER_ACTION_LOGOUT',0x08); 
    2934 
    3035/** 
     
    4449    /** Mobile session */ 
    4550    var $_mobileSession; 
     51    /** Action */ 
     52    var $_action; 
    4653 
    4754    /** 
     
    6067        $this -> _realName = ''; 
    6168        $this -> _hash = null; 
    62                 $this -> _mobileSession =  
    63                     isset($_POST['media']) && 'mobile' == $_POST['media']; 
    64                  
    65                 if ('mobile' ==  getThemeMedia()) { 
    66                     ini_set('session.use_trans_sid',true); 
    67                 session_start(); 
    68                 } 
     69         
     70         
     71        $this -> _mobileSession =  
     72            isset($_POST['media']) && 'mobile' == $_POST['media']; 
     73         
     74        if ('mobile' ==  getThemeMedia()) { 
     75            ini_set('session.use_trans_sid',true); 
     76            session_start(); 
     77        } 
    6978                 
    7079        if (array_key_exists('logout',$_GET)) { 
     
    8493                $cuname = $_cuname; 
    8594                $chash = $_chash; 
     95                $this -> _action = RSS_USER_ACTION_LOGIN; 
    8696            } 
    8797        } 
    8898        elseif (isset($_COOKIE[RSS_USER_COOKIE])) { 
    8999            list($cuname,$chash) = explode('|',$_COOKIE[RSS_USER_COOKIE]); 
     100            $this -> _action = RSS_USER_ACTION_COOKIE; 
    90101        } 
    91102        elseif(isset($_SESSION['mobile'])) { 
    92103            list($cuname,$chash) = explode('|',$_SESSION['mobile']); 
    93104            $this -> _mobileSession = true; 
     105            $this -> _action = RSS_USER_ACTION_SESSION; 
    94106        } 
    95107        if ($cuname && $chash) { 
     
    102114                $userIPs = explode(' ',$tmpUserIps); 
    103115                $subnet = preg_replace('#^([0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+$#','\1',$_SERVER['REMOTE_ADDR']); 
    104                 if (array_search($subnet, $userIPs) !== FALSE) { 
     116                if ((array_search($subnet, $userIPs) !== FALSE) || ($this -> _action != RSS_USER_ACTION_COOKIE)) { 
    105117                    $this -> _uid = $uid; 
    106118                    $this -> _uname = $uname;