moved admin to repo admin
[glcas.git] / libglcas / web.php
index 4f26a9b..157d293 100644 (file)
@@ -23,6 +23,7 @@ class GLCASWeb {
                
                // add a stat
                $ipaddr = $_SERVER["REMOTE_ADDR"];
+               $this->config->delData("lastseen", "$ipaddr");
                $this->config->addData("lastseen", "$ipaddr", time(), "");
                
                // create a url parser
@@ -167,7 +168,17 @@ function glcas_getLastSeen($ip, $data)
        
        if($last == "never") return $last;
        
-       $tdiff = time()-$last;
+       $last = glcas_tdiffToAgo(time()-$last);
+       
+       error_log("last for $ip set to $last");
+       
+       return $last;
+       
+}
+
+function glcas_tdiffToAgo($time_in_sec)
+{
+       $tdiff = $time_in_sec;
        $tdiff_min = (int)($tdiff/60);
        $tdiff_hour = (int)($tdiff/3600);
        $tdiff_days = (int)($tdiff/86400);
@@ -177,10 +188,7 @@ function glcas_getLastSeen($ip, $data)
        if($tdiff >= 7200 && $tdiff < 86400) $last = "$tdiff_hour hours ago";
        if($tdiff >= 86400) $last = "$tdiff_days days ago";
        
-       error_log("last for $ip set to $last");
-       
        return $last;
-       
 }
 
 function glcas_isRemoteDir($url)