2010-11-25 10:15:45 +00:00
|
|
|
<?php
|
|
|
|
require_once 'Metier/insee/classMInsee.php';
|
|
|
|
require_once 'Metier/insee/classMSirene.php';
|
|
|
|
require_once 'Metier/partenaires/classMBilans.php';
|
|
|
|
require_once 'Metier/partenaires/classMBourse.php';
|
|
|
|
require_once 'Metier/partenaires/classMLiens.php';
|
|
|
|
require_once 'Metier/partenaires/classMTva.php';
|
|
|
|
require_once 'Metier/partenaires/classMMap.php';
|
|
|
|
require_once 'Metier/partenaires/classMGreffes.php';
|
|
|
|
require_once 'Metier/partenaires/classMPrivileges.php';
|
|
|
|
require_once 'Metier/scores/classMFinancier.php';
|
|
|
|
require_once 'Metier/scores/classMSolvabilite.php';
|
|
|
|
|
|
|
|
require_once 'framework/mail/sendMail.php';
|
|
|
|
|
|
|
|
class WsScore
|
|
|
|
{
|
|
|
|
protected $dbConfig; //Configuration BDD Zend
|
|
|
|
protected $tabInfoUser; //Stockage des informations utilisateurs
|
|
|
|
|
2012-06-14 13:43:23 +00:00
|
|
|
/**
|
|
|
|
* List all application IPs
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $listApplicationIp = array (
|
|
|
|
'127.0.0.1', //Development, and WebService himself
|
|
|
|
'88.191.79.121', //Extranet
|
|
|
|
'78.31.45.206', //SDSL RAMBOUILLET
|
|
|
|
);
|
|
|
|
|
2010-12-02 16:34:55 +00:00
|
|
|
protected $listeDroits = array(
|
|
|
|
'KBIS' => 'Extrait RCS',
|
|
|
|
'ACTES' => 'Pièces officielles',
|
|
|
|
'IDPROCOL' => 'Fiche procédure collective',
|
|
|
|
'PRIVILEGES' => 'Privilèges',
|
|
|
|
'IPARI' => 'Investigation par l\'image IparI©',
|
|
|
|
'MARQUES' => 'Marques déposées',
|
|
|
|
'INDISCORE' => 'indiScore©',
|
|
|
|
'INDISCORE2' => 'Rapport synthetique',
|
|
|
|
'INDISCORE3' => 'Rapport complet',
|
2011-01-04 08:32:31 +00:00
|
|
|
'INDISCOREP' => 'indiScore+',
|
|
|
|
'INDISCORE2P' => 'Rapport synthetique+',
|
|
|
|
'INDISCORE3P' => 'Rapport complet+',
|
2010-12-02 16:34:55 +00:00
|
|
|
'SCORECSF' => 'Score CSF',
|
|
|
|
'EVENINSEE' => 'Évènements INSEE',
|
|
|
|
'AVISINSEE' => 'Avis de situation INSEE',
|
|
|
|
'SURVANNONCE' => 'Surveillance des annonces légales',
|
|
|
|
'SURVINSEE' => 'Surveillance des événements INSEE',
|
|
|
|
'SURVBILAN' => 'Surveillance des bilans',
|
|
|
|
'SURVSCORE' => 'Surveillance des événements sur le score',
|
|
|
|
'SURVACTES' => 'Surveillance des actes',
|
|
|
|
'SURVDIRIGEANTS'=> 'Surveillance des dirigeants',
|
2012-03-01 08:31:15 +00:00
|
|
|
'SURVPAIEMENTS' => 'Surveillance des paiements',
|
2012-05-23 12:41:00 +00:00
|
|
|
'SURVLIENS' => 'Surveillance des liens financiers',
|
2010-12-02 16:34:55 +00:00
|
|
|
'SURVPRIV' => 'Surveillance des privilèges',
|
|
|
|
'SURVLISTE' => 'Liste des surveillances',
|
|
|
|
'PORTEFEUILLE' => 'Portefeuille',
|
|
|
|
'INVESTIG' => 'Investigation',
|
|
|
|
'ENQUETEC' => 'Enquête commerciale',
|
|
|
|
'INTERNATIONAL' => 'Recherche Internationale',
|
|
|
|
'BDF' => 'Banque de France',
|
|
|
|
'MONPROFIL' => 'Mon profil',
|
|
|
|
'EDITION' => 'Mode Edition',
|
2011-05-25 10:20:05 +00:00
|
|
|
'UPLOADBILAN' => 'Saisie de bilan',
|
2011-12-02 16:39:52 +00:00
|
|
|
'DIRIGEANTSOP' => 'Liste des dirigeants opérationnels',
|
|
|
|
'RECHCSV' => 'Export des résultats de la recherche',
|
2012-03-12 10:23:21 +00:00
|
|
|
'HISTOBODACC' => 'Historique des annonces bodacc',
|
2012-03-29 13:06:29 +00:00
|
|
|
'AVISCREDIT' => 'Avis de crédit personnalisé',
|
2012-05-23 12:41:00 +00:00
|
|
|
'GROUPE' => 'Informations et organigramme du groupe',
|
2010-12-02 16:34:55 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
protected $listePrefs = array(
|
2011-12-14 10:48:05 +00:00
|
|
|
'NAF4' => "Afficher les anciens NAF",
|
|
|
|
'NACE' => "Afficher les codes NACES",
|
|
|
|
'NEWS' => "Afficher les news Google©",
|
|
|
|
'MAPPY' => "Afficher les façades d'immeubles",
|
|
|
|
'CARTES' => "Afficher les cartes et les plans",
|
|
|
|
'VOIRSURV' => "Afficher les entités sous surveillances",
|
|
|
|
'DEMANDEREF' => "Demande de référence par defaut",
|
|
|
|
'RECHREF' => "Afficher le formulaire de recherche par référence",
|
2010-12-02 16:34:55 +00:00
|
|
|
);
|
|
|
|
|
2011-02-02 17:14:47 +00:00
|
|
|
public $listError = array(
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2012-02-28 17:04:04 +00:00
|
|
|
'0900' => "Identifiant ou mot de passe incorrect",
|
2012-06-13 19:26:51 +00:00
|
|
|
'0901' => "Accès WS non authorisé pour cet utilisateur",
|
2012-02-28 17:04:04 +00:00
|
|
|
'0902' => "Méthode non authorisée dans votre profil",
|
|
|
|
'0903' => "Période d'accès au service invalide",
|
|
|
|
'0904' => "Adresse IP Invalide",
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2011-02-02 16:56:44 +00:00
|
|
|
'1010' => 'Siren invalide',
|
2011-06-22 07:50:04 +00:00
|
|
|
'1011' => 'Identifiant invalide',
|
2011-02-02 16:56:44 +00:00
|
|
|
'1020' => 'Siren inexistant',
|
2011-06-21 15:02:23 +00:00
|
|
|
'1021' => 'Type d\'identifiant inexistant',
|
2011-02-04 15:28:45 +00:00
|
|
|
'1030' => 'Aucun résultat pour ce siren en base',
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2011-02-02 14:53:25 +00:00
|
|
|
'3000' => 'Service disponible',
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2011-02-02 14:53:25 +00:00
|
|
|
'9000' => 'Service S&D indisponible',
|
|
|
|
'9001' => 'Service partenaire indisponible',
|
|
|
|
'9002' => 'Méthode provisoirement indisponible',
|
2011-02-03 14:04:40 +00:00
|
|
|
'9003' => 'Version du service désactivé',
|
|
|
|
'9004' => 'Version du service inexistant',
|
2011-02-02 14:53:25 +00:00
|
|
|
'9010' => 'Fichier indisponible',
|
|
|
|
'9020' => 'Requête incorrecte',
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2011-02-02 14:53:25 +00:00
|
|
|
);
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2010-12-02 16:34:55 +00:00
|
|
|
public function __construct()
|
2010-11-25 10:15:45 +00:00
|
|
|
{
|
2010-11-25 16:51:05 +00:00
|
|
|
define ('DATETIME', date('YmdHis'));
|
|
|
|
define ('DATE', substr(DATETIME,0,8));
|
|
|
|
define ('TIME', substr(DATETIME,8,6));
|
|
|
|
define ('DATE_LISIBLE', substr(DATETIME,6,2).'/'.substr(DATETIME,4,2).'/'.substr(DATETIME,0,4));
|
|
|
|
define ('TIME_LISIBLE', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
|
|
|
|
|
2012-06-21 06:04:29 +00:00
|
|
|
$this->dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/databases.ini');
|
2010-11-25 10:15:45 +00:00
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2011-02-02 14:53:25 +00:00
|
|
|
protected function sendError($code)
|
|
|
|
{
|
|
|
|
$message = 'Erreur inconnue';
|
2011-02-02 15:30:33 +00:00
|
|
|
if (array_key_exists($code, $this->listError)){
|
|
|
|
$message = $this->listError[$code];
|
2011-02-02 14:53:25 +00:00
|
|
|
}
|
|
|
|
throw new SoapFault($code,$message);
|
|
|
|
exit;
|
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2011-01-13 16:52:27 +00:00
|
|
|
/**
|
|
|
|
* Enregistre l'appel utilisateur à une méthode
|
|
|
|
* @param $service
|
|
|
|
* @param $siret
|
|
|
|
* @param $ref
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function wsLog($service, $siret='', $ref='')
|
|
|
|
{
|
|
|
|
$iDbCrm = new WDB('sdv1');
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2011-01-13 16:52:27 +00:00
|
|
|
if (strlen($siret)==14) {
|
2012-01-09 14:47:19 +00:00
|
|
|
$siren = substr($siret,0,9);
|
|
|
|
$nic = substr($siret,9,5);
|
2011-01-13 16:52:27 +00:00
|
|
|
} elseif (strlen($siret)==9) {
|
|
|
|
$siren=$siret;
|
|
|
|
$nic='';
|
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
|
|
|
//Is it a test
|
2012-01-09 14:06:29 +00:00
|
|
|
if ($this->tabInfoUser['clientTest']=='Oui' || $this->tabInfoUser['typeCompte']=='TEST') {
|
2011-12-05 08:14:54 +00:00
|
|
|
$test=1;
|
|
|
|
} else {
|
|
|
|
$test=0;
|
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2012-07-02 13:43:02 +00:00
|
|
|
//Read if client has pricing for this service
|
2012-05-23 12:41:00 +00:00
|
|
|
$pricing = $iDbCrm->select('clientsTarif', 'login, service',
|
|
|
|
"log='".$service."' AND idClient=" . $this->tabInfoUser['idClient'] .
|
|
|
|
" AND (service='".$this->tabInfoUser['service']."' OR service='') AND (login='".$this->tabInfoUser['login']."' OR login='') ".
|
2012-07-02 13:43:02 +00:00
|
|
|
" ORDER BY service, login DESC LIMIT 1", true);
|
2012-05-23 12:41:00 +00:00
|
|
|
|
|
|
|
if ( count($pricing)>0 ) {
|
|
|
|
//Update count access to a service
|
2012-07-02 13:43:02 +00:00
|
|
|
$sql = "UPDATE logsCount SET conso=conso+1 WHERE jour=CURDATE() AND idClient=".$this->tabInfoUser['idClient'].
|
2012-05-23 12:41:00 +00:00
|
|
|
" AND service='".$pricing[0]['service']."' AND login='".$pricing[0]['login']."' AND log='".$service."'";
|
|
|
|
$iDbCrm->query($sql);
|
|
|
|
$updateOk = $iDbCrm->getAffectedRows();
|
|
|
|
//If not insert
|
|
|
|
if ($updateOk==0) {
|
|
|
|
$sql = "INSERT INTO logsCount (jour, idClient, service, login, log, conso) ".
|
|
|
|
"VALUES (NOW(), ".$this->tabInfoUser['idClient'].", '".$pricing[0]['service']."', '".$pricing[0]['login']."', '".$service."', 1) ";
|
|
|
|
$iDbCrm->query($sql);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-09 14:47:19 +00:00
|
|
|
$rs = '';
|
|
|
|
$cp = '';
|
|
|
|
$vil = '';
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2012-01-09 14:47:19 +00:00
|
|
|
$tabRdvInsee = array();
|
2012-01-24 17:27:48 +00:00
|
|
|
if (in_array($service, array(
|
2012-05-23 12:41:00 +00:00
|
|
|
'identite',
|
|
|
|
'greffe_bilans',
|
|
|
|
'greffe_actes',
|
|
|
|
'liens',
|
|
|
|
'dirigeants',
|
2012-01-09 14:47:19 +00:00
|
|
|
'etablissements',
|
2012-05-23 12:41:00 +00:00
|
|
|
'dirigeantsOp',
|
|
|
|
'kbis',
|
2012-01-24 17:27:48 +00:00
|
|
|
'indiscore', 'indiscore2', 'indiscore3', 'rapport2', 'rapport3'))
|
|
|
|
) {
|
2012-01-09 14:47:19 +00:00
|
|
|
if (intval($siren)>1000 && intval($nic)>9) $strNic=" AND nic=$nic ";
|
|
|
|
elseif (intval($siren)==0 && $ref>0) $strNic=" AND id=$ref ";
|
|
|
|
elseif (intval($siren)>1000) $strNic=" AND siege=1 ORDER BY actif DESC, nic DESC ";
|
2011-12-05 08:14:54 +00:00
|
|
|
else return;
|
2012-05-23 12:41:00 +00:00
|
|
|
$rep = $iDbCrm->select('jo.etablissements',
|
|
|
|
'siren, nic, actif, siege, raisonSociale, adr_cp, adr_ville, source',
|
2012-01-09 14:06:29 +00:00
|
|
|
"siren=$siren $strNic", false, MYSQL_ASSOC);
|
|
|
|
$tabRep = $rep[0];
|
|
|
|
$rs = $tabRep['raisonSociale'];
|
|
|
|
$cp = $tabRep['adr_cp'];
|
|
|
|
$vil = $tabRep['adr_ville'];
|
2011-12-05 08:14:54 +00:00
|
|
|
$tabRdvInsee['source']=$tabRep['source'];
|
|
|
|
if ($tabRep['actif']==0)
|
|
|
|
$tabRdvInsee['actifInsee']=0;
|
2012-01-09 14:47:19 +00:00
|
|
|
elseif (intval($siren)>1000) {
|
2011-12-05 08:14:54 +00:00
|
|
|
$tabRdvInsee['actifInsee']=1;
|
|
|
|
$rep=$iDbCrm->select('jo.rncs_entrep', 'count(*) AS nb', "siren=$siren", false, MYSQL_ASSOC);
|
|
|
|
$tabRep=$rep[0];
|
|
|
|
if ($tabRep['nb']>0) $tabRdvInsee['source']=5;
|
|
|
|
}
|
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
$tabInsert = array(
|
2011-12-05 08:14:54 +00:00
|
|
|
'login' => $this->tabInfoUser['login'],
|
|
|
|
'idClient' => $this->tabInfoUser['idClient'],
|
|
|
|
'page' => $service,
|
|
|
|
'siren' => $siren,
|
|
|
|
'nic' => $nic,
|
|
|
|
'params' => $ref,
|
|
|
|
'test' => $test,
|
|
|
|
'raisonSociale' => $rs,
|
|
|
|
'cp' => $cp,
|
|
|
|
'ville' => $vil,
|
|
|
|
'ipClient' => $this->tabInfoUser['ipConnexion'],
|
2011-01-13 16:52:27 +00:00
|
|
|
);
|
2011-12-05 08:14:54 +00:00
|
|
|
$rep = $iDbCrm->insert('logs', array_merge($tabInsert,$tabRdvInsee), false, true);
|
2011-01-13 16:52:27 +00:00
|
|
|
}
|
2010-11-25 10:15:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne une erreur soap lors d'une mauvaise authentification
|
|
|
|
* @throws SoapFault
|
|
|
|
*/
|
|
|
|
protected function authenticate()
|
|
|
|
{
|
2012-05-23 12:41:00 +00:00
|
|
|
$auth = $this->checkAuth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $_SERVER['REMOTE_ADDR']);
|
2012-02-28 17:04:04 +00:00
|
|
|
if ( $auth === false ) {
|
2011-02-02 14:53:25 +00:00
|
|
|
$this->sendError('0900');
|
2012-02-28 17:04:04 +00:00
|
|
|
} elseif ( $auth !== true ) {
|
|
|
|
$this->sendError($auth);
|
2010-11-25 10:15:45 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2011-01-06 16:26:46 +00:00
|
|
|
protected function permission($perm)
|
|
|
|
{
|
2011-01-25 09:28:28 +00:00
|
|
|
if ( !$this->checkPerm($perm) ){
|
2011-02-02 14:53:25 +00:00
|
|
|
$this->sendError('0902');
|
2011-01-06 16:26:46 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2010-11-25 10:15:45 +00:00
|
|
|
|
2010-12-07 09:37:06 +00:00
|
|
|
/**
|
|
|
|
* checkAccesWS
|
|
|
|
* @throws SoapFault
|
|
|
|
*/
|
|
|
|
protected function checkAccesWS()
|
|
|
|
{
|
|
|
|
//Vérifier que l'utilisateur à le droit accesWS (clients/utilisateurs)
|
|
|
|
$accesWs = $this->tabInfoUser['accesWS'];
|
|
|
|
if ($accesWs){
|
2011-02-02 14:53:25 +00:00
|
|
|
$this->sendError('0901');
|
2010-12-07 09:37:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* checPerm
|
|
|
|
* @param string $perm
|
|
|
|
* @throws SoapFault
|
|
|
|
*/
|
|
|
|
protected function checkPerm($perm)
|
|
|
|
{
|
|
|
|
$droits = $this->tabInfoUser['droits'];
|
2011-01-06 16:26:46 +00:00
|
|
|
$output = false;
|
|
|
|
if ( preg_match('/\b'.$perm.'\b/i', $droits) ){
|
|
|
|
$output = true;
|
2010-12-07 09:37:06 +00:00
|
|
|
}
|
2011-01-06 16:26:46 +00:00
|
|
|
return $output;
|
2010-12-07 09:37:06 +00:00
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2010-11-25 10:15:45 +00:00
|
|
|
/**
|
|
|
|
* checkAuth
|
|
|
|
* @param string $login
|
|
|
|
* @param string $password
|
|
|
|
* @param string $ipConnexion
|
2012-02-28 17:04:04 +00:00
|
|
|
* @return mixed
|
2010-11-25 10:15:45 +00:00
|
|
|
*/
|
|
|
|
protected function checkAuth($login, $password, $ipConnexion)
|
|
|
|
{
|
|
|
|
$iDbCrm = new WDB('sdv1');
|
2012-02-28 17:04:04 +00:00
|
|
|
$rep = $iDbCrm->select(
|
2011-12-12 09:35:01 +00:00
|
|
|
'utilisateurs u, clients c',
|
2012-06-14 13:43:23 +00:00
|
|
|
'u.login, u.id, u.email, u.password, u.idClient, u.typeCompte, u.actif, u.filtre_ip, u.profil,'.
|
|
|
|
' u.pref, u.rechRefType, u.profil, u.nombreConnexions, u.dateDerniereConnexion, u.droits,'.
|
|
|
|
' u.referenceParDefaut, u.nbReponses, u.formatMail, u.dateDebutCompte, u.dateFinCompte, u.accesWS,'.
|
2012-06-21 06:04:29 +00:00
|
|
|
' u.acceptationCGU,'.
|
2012-06-14 13:43:23 +00:00
|
|
|
' c.droits AS droitsClients, c.test AS clientTest, c.typeScore, c.timeout',
|
2011-12-12 09:35:01 +00:00
|
|
|
"u.login='$login' AND u.idClient=c.id AND u.actif=1 AND u.deleted=0 AND c.actif='Oui'",
|
|
|
|
false, MYSQL_ASSOC
|
2012-05-23 12:41:00 +00:00
|
|
|
);
|
2010-11-25 10:15:45 +00:00
|
|
|
if (count($rep)>0)
|
|
|
|
{
|
2012-03-06 10:16:47 +00:00
|
|
|
// Récupération des informations de connexion
|
2012-05-23 12:41:00 +00:00
|
|
|
$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))) )
|
2011-12-05 08:14:54 +00:00
|
|
|
{
|
2012-03-15 15:01:45 +00:00
|
|
|
$timeOutSec = $tabRep['timeout'];
|
2010-11-25 10:15:45 +00:00
|
|
|
if ($timeOutSec==0) $timeOutSec=1800;
|
2011-12-12 09:35:01 +00:00
|
|
|
$this->tabInfoUser = array(
|
|
|
|
'login' => $login,
|
|
|
|
'id' => $tabRep['id'],
|
|
|
|
'email' => $tabRep['email'],
|
|
|
|
'typeCompte' => $tabRep['typeCompte'],
|
|
|
|
'idClient' => $tabRep['idClient'],
|
|
|
|
'filtre_ip' => $tabRep['filtre_ip'],
|
|
|
|
'ipConnexion' => $ipConnexion,
|
|
|
|
'pref' => $tabRep['pref'],
|
|
|
|
'rechRefType' => $tabRep['rechRefType'],
|
|
|
|
'profil' => $tabRep['profil'],
|
|
|
|
'nombreConnexions' => $tabRep['nombreConnexions'],
|
|
|
|
'dateDerniereConnexion' => $tabRep['dateDerniereConnexion'],
|
|
|
|
'droits' => $tabRep['droits'],
|
|
|
|
'droitsClients' => $tabRep['droitsClients'],
|
|
|
|
'timeout' => $timeOutSec,
|
|
|
|
'clientTest' => $tabRep['clientTest'],
|
|
|
|
'typeScore' => $tabRep['typeScore'],
|
|
|
|
'nbReponses' => $tabRep['nbReponses'],
|
|
|
|
'formatMail' => $tabRep['formatMail'],
|
|
|
|
'referenceParDefaut' => $tabRep['referenceParDefaut'],
|
|
|
|
'dateDebutCompte' => $tabRep['dateDebutCompte'],
|
|
|
|
'dateFinCompte' => $tabRep['dateFinCompte'],
|
2012-06-21 06:04:29 +00:00
|
|
|
'acceptationCGU' => $tabRep['acceptationCGU']
|
2010-11-25 10:15:45 +00:00
|
|
|
);
|
2012-05-23 12:41:00 +00:00
|
|
|
debugLog('W',"CheckAuth $login/$password OK", __LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
|
|
|
|
2012-03-06 10:16:47 +00:00
|
|
|
/**
|
|
|
|
* Date de debut de compte
|
|
|
|
*/
|
|
|
|
if ( !empty($tabRep['dateDebutCompte']) && $tabRep['dateDebutCompte']!='0000-00-00' ) {
|
2012-02-28 17:04:04 +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 ) {
|
|
|
|
return '0903';
|
2012-05-23 12:41:00 +00:00
|
|
|
}
|
2012-02-28 17:04:04 +00:00
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2012-03-06 10:16:47 +00:00
|
|
|
/**
|
|
|
|
* Date de fin de compte
|
|
|
|
*/
|
|
|
|
if ( !empty($tabRep['dateFinCompte']) && $tabRep['dateFinCompte']!='0000-00-00' ) {
|
2012-02-28 17:04:04 +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) {
|
|
|
|
return '0903';
|
2012-05-23 12:41:00 +00:00
|
|
|
}
|
2012-02-28 17:04:04 +00:00
|
|
|
}
|
2012-05-23 12:41:00 +00:00
|
|
|
|
2012-06-14 13:43:23 +00:00
|
|
|
/**
|
|
|
|
* Acces WS, block access to other apps
|
|
|
|
*/
|
|
|
|
if ($tabRep['accesWS']==1) {
|
|
|
|
if ( in_array($ipConnexion, $this->listApplicationIp) && $tabRep['idClient']!=1 ) {
|
|
|
|
file_put_contents('test.log', 'ERREUR', FILE_APPEND);
|
|
|
|
return '0901';
|
|
|
|
}
|
|
|
|
}
|
2012-06-21 08:13:28 +00:00
|
|
|
|
2012-05-23 12:41:00 +00:00
|
|
|
return true;
|
2010-11-25 10:15:45 +00:00
|
|
|
}
|
|
|
|
debugLog('W',"CheckAuth $login/$password incorrect (IP=$ipConnexion)", __LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
debugLog('W',"CheckAuth $login/$password inexistant ou inactif (IP=$ipConnexion)", __LINE__,__FILE__, __FUNCTION__, __CLASS__);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|