diff --git a/library/WsScore/Gestion/v0.1/Gestion.php b/library/WsScore/Gestion/v0.1/Gestion.php index 42315f7a..879e2229 100644 --- a/library/WsScore/Gestion/v0.1/Gestion.php +++ b/library/WsScore/Gestion/v0.1/Gestion.php @@ -13,12 +13,18 @@ class Gestion extends WsScore public function getInfosLogin($login, $ipUtilisateur = '') { $this->authenticate(); - + //Initialisation if (empty($ipUtilisateur)) $ipUtilisateur = $_SERVER['REMOTE_ADDR']; $error = new ErrorType(); $result = new InfosLogin(); + //Filtre IP + $filtre = trim($this->tabInfoUser['filtre_ip']); + if ( !empty($filtre) && !checkPlagesIp($filtre, $ipUtilisateur) ){ + $this->sendError('0904'); + } + debugLog('I',"getInfosLogin pour $login (IP=$ipUtilisateur)",__LINE__,__FILE__, __FUNCTION__, __CLASS__); //L'utilisateur qui demande les informations est différent @@ -104,10 +110,6 @@ class Gestion extends WsScore } } - - - - $result->connected = $connected; $result->login = $this->tabInfoUser['login']; $result->id = $this->tabInfoUser['id']; diff --git a/library/WsScore/WsScore.php b/library/WsScore/WsScore.php index 7b9b752b..308127d8 100644 --- a/library/WsScore/WsScore.php +++ b/library/WsScore/WsScore.php @@ -268,11 +268,12 @@ class WsScore ); if (count($rep)>0) { + // Récupération des informations de connexion $tabRep = $rep[0]; if ( $tabRep['password']==$password || $tabRep['password']==md5($password) || $password==md5($login.'|'.$tabRep['password']) - || (substr($password,0,7)=='iponly:' && checkPlagesIp($tabRep['filtre_ip'], substr($password,7)))) + || ( substr($password,0,7)=='iponly:' && checkPlagesIp($tabRep['filtre_ip'], substr($password,7))) ) { $timeOutSec = $tabRep['timeout']*60; if ($timeOutSec==0) $timeOutSec=1800; @@ -322,7 +323,10 @@ class WsScore ); debugLog('W',"CheckAuth $login/$password OK", __LINE__,__FILE__, __FUNCTION__, __CLASS__); - if ( !empty($tabRep['dateDebutCompte']) ) { + /** + * Date de debut de compte + */ + if ( !empty($tabRep['dateDebutCompte']) && $tabRep['dateDebutCompte']!='0000-00-00' ) { $today = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $dateDebutCompte = mktime(0, 0, 0, substr($tabRep['dateDebutCompte'],5,2), substr($tabRep['dateDebutCompte'],8,2), substr($tabRep['dateDebutCompte'],0,4)); if ( $today < $dateDebutCompte ) { @@ -330,7 +334,10 @@ class WsScore } } - if ( !empty($tabRep['dateDebutCompte']) ) { + /** + * Date de fin de compte + */ + if ( !empty($tabRep['dateFinCompte']) && $tabRep['dateFinCompte']!='0000-00-00' ) { $today = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $dateFinCompte = mktime(0, 0, 0, substr($tabRep['dateFinCompte'],5,2), substr($tabRep['dateFinCompte'],8,2), substr($tabRep['dateFinCompte'],0,4)); if ( $today > $dateFinCompte) { @@ -338,9 +345,6 @@ class WsScore } } - if ( !empty($tabRep['filtre_ip']) && !checkPlagesIp($tabRep['filtre_ip'],$ipConnexion) ){ - return '0904'; - } return true; } debugLog('W',"CheckAuth $login/$password incorrect (IP=$ipConnexion)", __LINE__,__FILE__, __FUNCTION__, __CLASS__);