exit; } } } elseif ($_SESSION['config']['how_to_connect_user'] == "dbconges" || $session_username == "admin" || $session_username != "conges" && !$_SESSION['config']['responsable_virtuel']) { $username_conges = autentification_passwd_conges($session_username, $session_password); if ($username_conges != $session_username) { $session = ""; $session_username = ""; $session_password = ""; $erreur = "login_passwd_incorrect"; // appel du formulaire d'intentification (login/password) session_saisie_user_password($erreur, $session_username, $session_password); exit; } else { // on initialise la nouvelle session session_create($session_username); } } } } } /*****************************************************************/ if (isset($_SESSION['userlogin'])) { $request = "SELECT u_nom, u_passwd, u_prenom, u_is_resp FROM conges_users where u_login = '******'userlogin']) . "' "; $rs = SQL::query($request); if ($rs->num_rows != 1) { redirect(ROOT_PATH . 'index.php'); } else { $session = session_id(); $row = $rs->fetch_array(); $NOM = $row["u_nom"];
function authentification_passwd_conges_CAS() { // import de la librairie CAS include LIBRARY_PATH . 'CAS/CAS.php'; // import des paramètres du serveur CAS $config_CAS_host = $_SESSION['config']['CAS_host']; $config_CAS_portNumber = $_SESSION['config']['CAS_portNumber']; $config_CAS_URI = $_SESSION['config']['CAS_URI']; $config_CAS_CACERT = $_SESSION['config']['CAS_CACERT']; global $connexionCAS; global $logoutCas; phpCAS::setDebug(); // initialisation phpCAS if ($connexionCAS != "active") { $CASCnx = phpCAS::client(CAS_VERSION_2_0, $config_CAS_host, $config_CAS_portNumber, $config_CAS_URI); $connexionCAS = "active"; } if ($logoutCas == 1) { phpCAS::logout(); } // Vérification SSL if (isset($config_CAS_CACERT)) { phpCAS::setCasServerCACert($config_CAS_CACERT); } else { phpCAS::setNoCasServerValidation(); } // authentificationCAS (redirection vers la page d'authentification de CAS) phpCAS::forceAuthentication(); $usernameCAS = phpCAS::getUser(); //On nettoie la session créée par phpCAS session_destroy(); // On créé la session gérée par Libertempo session_create($usernameCAS); //ON VERIFIE ICI QUE L'UTILISATEUR EST DEJA ENREGISTRE SOUS DBCONGES $req_conges = 'SELECT u_login FROM conges_users WHERE u_login=\'' . \includes\SQL::quote($usernameCAS) . '\''; $res_conges = \includes\SQL::query($req_conges); $num_row_conges = $res_conges->num_rows; if ($num_row_conges != 0) { return $usernameCAS; } else { return ''; } }
<?php require_once(ROOT.DS.MAIN.DS.'library'.DS.'session_check.php'); require_once(ROOT.DS.MAIN.DS.'library'.DS.'session_create.php'); if($this->_postName !=='login' && (session_check() || session_create())) { if($this->_postName === '') { header("Cache-Control: no-cache"); require(ROOT.DS.MAIN.DS.'reflex'.DS.'admin'.DS.'documents'.DS.'index.php'); } else if(file_exists(ROOT.DS.MAIN.DS.'reflex'.DS.'admin'.DS.'documents'.DS.$this->_postName.'.php')) { header("Cache-Control: no-cache"); require(ROOT.DS.MAIN.DS.'reflex'.DS.'admin'.DS.'documents'.DS.$this->_postName.'.php'); } else if(file_exists(strtolower(ROOT.DS.MAIN.DS.'reflex'.DS.'admin'.DS.'documents'.DS.$this->_postName.'.php'))) { $pageURL = 'http'; $pageURL .= '://'.THIS_DOMAIN.'/'.ADMIN_URL.'/'.strtolower($this->_postName); header ('HTTP/1.1 301 Moved Permanently'); header ('Location: '.$pageURL); exit; } else { $pageURL = 'http'; $pageURL .= '://'.THIS_DOMAIN.'/'.ADMIN_URL; header ('HTTP/1.1 301 Moved Permanently'); header ('Location: '.$pageURL); exit; } } else { if($this->_postName === 'login') { header("Cache-Control: no-cache"); require(ROOT.DS.MAIN.DS.'reflex'.DS.'admin'.DS.'documents'.DS.'login.php');
function authentification_passwd_conges_CAS() { // import de la librairie CAS include LIBRARY_PATH . 'CAS/CAS.php'; // import des paramètres du serveur CAS $config_CAS_host = $_SESSION['config']['CAS_host']; $config_CAS_portNumber = $_SESSION['config']['CAS_portNumber']; $config_CAS_URI = $_SESSION['config']['CAS_URI']; global $connexionCAS; global $logoutCas; phpCAS::setDebug(); // initialisation phpCAS if ($connexionCAS != "active") { $CASCnx = phpCAS::client(CAS_VERSION_2_0, $config_CAS_host, $config_CAS_portNumber, $config_CAS_URI); $connexionCAS = "active"; } if ($logoutCas == 1) { phpCAS::logout(); } // authentificationCAS (redirection vers la page d'authentification de CAS) // setCasServerCACert a besoin du certificat au format pem. Il faut ajouter l'option d'import du certificat dans les préférences... En attendant setNoCasServer... phpCAS::setNoCasServerValidation(); phpCAS::forceAuthentication(); $usernameCAS = phpCAS::getUser(); session_create($usernameCAS); //ON VERIFIE ICI QUE L'UTILISATEUR EST DEJA ENREGISTRE SOUS DBCONGES $req_conges = 'SELECT u_login FROM conges_users WHERE u_login=\'' . SQL::quote($usernameCAS) . '\''; $res_conges = SQL::query($req_conges); $num_row_conges = $res_conges->num_rows; if ($num_row_conges != 0) { return $usernameCAS; } return ''; }