Correction prise en compte différents format pour les dates et suppression du controle par IP, issue #0001087

This commit is contained in:
Michael RICOIS 2012-03-06 10:16:47 +00:00
parent 14fc4c7068
commit c0bacfbcda
2 changed files with 17 additions and 11 deletions

View File

@ -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'];

View File

@ -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__);