111 lines
4.4 KiB
PHP
111 lines
4.4 KiB
PHP
<?php
|
|
//Vérification en session
|
|
if ($_REQUEST['checkIp']=='only'){
|
|
|
|
if (trim($_REQUEST['login'])=='') {
|
|
$message="Erreur 10300 : Identifiant de connexion et/ou mot de passe incorrect !";
|
|
include('./pages/logout.php');
|
|
die();
|
|
}
|
|
|
|
$login = $_REQUEST['login'];
|
|
$hach = 'iponly:'.$_SERVER['REMOTE_ADDR'];
|
|
}
|
|
elseif ($_SESSION['connected']==TRUE && $_REQUEST['action']!='logon')
|
|
{
|
|
// On vérifie la validité de la session
|
|
$tabInfo=$_SESSION['tabInfo'];
|
|
if ($tabInfo['date_last_action']+$timeout<time()) {
|
|
$message="Vous avez été déconnecté de l'extranet suite à un délai d'inactivité trop long (1)";
|
|
include('./pages/logout.php');
|
|
}
|
|
// On met à jour l'heure de la dernière action
|
|
$tabInfo['date_last_action']=time();
|
|
$_SESSION['tabInfo']=$tabInfo;
|
|
|
|
//Affectation Login et pass
|
|
$login = $_SESSION['tabInfo']['login'];
|
|
($_REQUEST['checkIp']=='only' || strstr($hach, 'iponly:')!=FALSE ) ? ($hach = 'iponly:'.$_SERVER['REMOTE_ADDR']) : ($hach = $_SESSION['tabInfo']['password']);
|
|
|
|
}elseif ($page!='main' && $_REQUEST['action']!='logon') {
|
|
|
|
$message="Vous avez été déconnecté de l'extranet suite à un délai d'inactivité trop long (2)";
|
|
include('./pages/logout.php');
|
|
}
|
|
|
|
/** Déclation du client Soap auprès du webservice **/
|
|
$client = new SoapClient(null, array( 'trace' => 1,
|
|
'soap_version' => SOAP_1_1,
|
|
'location' => WEBSERVICE_URL,
|
|
'uri' => WEBSERVICE_URI,
|
|
'login' => $login,
|
|
'password' => $hach
|
|
));
|
|
|
|
|
|
if($_SESSION['connected']==FALSE || $_REQUEST['action']=='logon'){
|
|
|
|
//Récupération des infos si pas de session
|
|
try {
|
|
$O = $client->getInfosLogin($login, $_SERVER['REMOTE_ADDR']);
|
|
$user=$O['result'];
|
|
if ($user['connected']==true)
|
|
{
|
|
$tabInfo['login'] = $login;
|
|
$tabInfo['password'] = $hach;
|
|
$tabInfo['email'] = $user['email'];
|
|
$tabInfo['ip'] = $_SERVER['REMOTE_ADDR'];
|
|
$tabInfo['host'] = gethostbyaddr($tabInfo['ip']);
|
|
$tabInfo['resolution'] = $_REQUEST['resolution'];
|
|
$tabInfo['nbcolors'] = $_REQUEST['nbcolors'];
|
|
$tabInfo['user_agent'] = $tab['client_ua'];
|
|
$tabInfo['referer1'] = $tab['client_referer'];
|
|
$tabInfo['referer2'] = $_SERVER['HTTP_REFERER'];
|
|
$tabInfo['referer_login'] = $_SERVER['HTTP_REFERER'];
|
|
$tabInfo['date_page_www'] = $tab['client_connexion'];
|
|
$tabInfo['date_login'] = time();
|
|
$tabInfo['date_last_action']= time();
|
|
$tabInfo['nbReponses'] = $user['nbReponses'];
|
|
$tabInfo['cookie_client'] = md5('login'.$cookieSecure);
|
|
$tabInfo['mode_edition'] = 0;
|
|
$tabInfo['profil'] = $user['profil'];
|
|
$tabInfo['pref'] = $user['pref'];
|
|
$tabInfo['droits'] = $user['droits'];
|
|
$tabInfo['nom'] = $user['nom'];
|
|
$tabInfo['prenom'] = $user['prenom'];
|
|
$tabInfo['id'] = $user['id'];
|
|
$tabInfo['idClient'] = $user['idClient'];
|
|
$tabInfo['reference'] = $user['reference'];
|
|
|
|
$_SESSION['connected']=true;
|
|
$_SESSION['tabInfo']=$tabInfo;
|
|
|
|
include('./pages/main.php');
|
|
logAction($tabInfo['login'], $page, $_REQUEST['siret'], $tabInfo['ip'], $tabInfo['host'], $tabInfo['resolution'], $tabInfo['nbcolors'], $tabInfo['user_agent'],$tabInfo['referer1'], gmdate('Y/m/d H:i:s',$tabInfo['date_login']+3600), gmdate('Y/m/d H:i:s',$tabInfo['date_last_action']+3600), implode(', ',$_REQUEST));
|
|
|
|
} elseif ($O['error']['errnum']<>0) {
|
|
$message='Erreur '. $O['error']['errnum'] .' : '. $O['error']['errmsg'];
|
|
include('./pages/logout.php');
|
|
logAction($tabInfo['login'], $page, $_REQUEST['siret'], $tabInfo['ip'], $tabInfo['host'], $tabInfo['resolution'], $tabInfo['nbcolors'], $tabInfo['user_agent'],$tabInfo['referer1'], gmdate('Y/m/d H:i:s',$tabInfo['date_login']+3600), gmdate('Y/m/d H:i:s',$tabInfo['date_last_action']+3600), implode(', ',$_REQUEST));
|
|
print_r($tabInfoUser);
|
|
die();
|
|
}
|
|
else {
|
|
$message="Erreur 10302 : Identifiant de connexion et/ou mot de passe incorrect !";
|
|
include('./pages/logout.php');
|
|
logAction($tabInfo['login'], $page, $_REQUEST['siret'], $tabInfo['ip'], $tabInfo['host'], $tabInfo['resolution'], $tabInfo['nbcolors'], $tabInfo['user_agent'],$tabInfo['referer1'], gmdate('Y/m/d H:i:s',$tabInfo['date_login']+3600), gmdate('Y/m/d H:i:s',$tabInfo['date_last_action']+3600), implode(', ',$_REQUEST));
|
|
print_r($tabInfoUser);
|
|
die();
|
|
}
|
|
die();
|
|
} catch (SoapFault $fault) {
|
|
$message="Erreur 10301 : Identifiant de connexion et/ou mot de passe incorrect !";
|
|
include('./pages/logout.php');
|
|
die();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|