security - timestamp of last active updated on login

This commit is contained in:
Ulf Gebhardt 2014-01-25 19:42:21 +01:00
parent 6f7f455ac3
commit 39e545fdde
2 changed files with 11 additions and 9 deletions

View File

@ -1,7 +1,11 @@
<?php
namespace SYSTEM\DBD;
class SYS_SECURITY_TRACK_LOGINS extends \SYSTEM\DB\QP {
//using QI:
//this does not return true nessecary,
//since if called in a very short time twice
//the affected row count could be zero and therefore return false!
class SYS_SECURITY_UPDATE_LASTACTIVE extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg

View File

@ -64,15 +64,11 @@ class Security {
$row[\SYSTEM\DBD\system_user::FIELD_LOCALE],
\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL));
if(isset($locale)){
\SYSTEM\locale::set($locale);}
// track succesful user login
//self::trackLogins($row[\SYSTEM\DBD\system_user::FIELD_ID]);
\SYSTEM\locale::set($locale);}
\SYSTEM\DBD\SYS_SECURITY_UPDATE_LASTACTIVE::QI(array(microtime(true), $row[\SYSTEM\DBD\system_user::FIELD_ID]));
return ($advancedResult ? $row : self::OK);
}
//todo: remove
private static function trackLogins($userID){
\SYSTEM\DBD\SYS_SECURITY_TRACK_LOGINS::QQ(array(microtime(true), $userID));}
public static function getUser(){
if(!self::isLoggedIn()){
@ -122,7 +118,9 @@ class Security {
public static function isLoggedIn(){
self::startSession();
return (isset($_SESSION['user']) && $_SESSION['user'] instanceof User && $_SESSION['user']->base_url === \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL));}
return (isset($_SESSION['user']) &&
$_SESSION['user'] instanceof User &&
$_SESSION['user']->base_url === \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL));}
private static function startSession(){
if(!isset($_SESSION) && !headers_sent()){