Merge branch 'extended-cookie'
[scuttle] / services / userservice.php
index 44374a076e09d8a8f053f30201046c27a4ae614b..b55a7df44ec63f8f0bf75f70400f8bee3f81597f 100644 (file)
@@ -19,7 +19,7 @@ class UserService {
   var $tablename;
   var $sessionkey;
   var $cookiekey;
-  var $cookietime = 1209600; // 2 weeks
+  var $cookietime = 63072000; // 2 years
 
     function UserService(&$db) {
         $this->db =& $db;
@@ -41,7 +41,7 @@ class UserService {
         if(!empty($host)) {
             @exec("nslookup -type=$type $host", $output);
             while(list($k, $line) = each($output)) {
-                if(eregi("^$host", $line)) {
+                if(preg_match("/^$host/i", $line)) {   //eregi("^$host", $line)
                     return true;
                 }
             }
@@ -132,7 +132,7 @@ class UserService {
         if (isset($_SESSION[$this->getSessionKey()])) {
             return $_SESSION[$this->getSessionKey()];
         } else if (isset($_COOKIE[$this->getCookieKey()])) {
-            $cook = split(':', $_COOKIE[$this->getCookieKey()]);
+            $cook = explode(':', $_COOKIE[$this->getCookieKey()]); //split(':', $_COOKIE[$this->getCookieKey()]);
             //cookie looks like this: 'id:md5(username+password)'
             $query = 'SELECT * FROM '. $this->getTableName() .
                      ' WHERE MD5(CONCAT('.$this->getFieldName('username') .

Benjamin Mako Hill || Want to submit a patch?