} } } else { if (!isset($_GET['logout'])) { $pool = new interPool(); if (!is_null($pool->readCookie("pmh"))) { $cValue = $pool->readCookie("pmh"); $cValueA = explode(":", $cValue); $username = $cValueA[0]; $password = $cValueA[1]; $id_pool = $cValueA[2]; if (!$pool->dbConnect("pmh")) { $message = "Problèmes avec la base de données. Ré-essayez plus tard..."; } else { $id_pool = $pool->getIdPoolForLogin("PMH"); $rtn = $pool->validate_login($username, $password, $id_pool); $rtnL = explode(" ", $rtn); if ($rtnL[0] != "OK") { $message = $rtn; } else { $id_gerant = $rtnL[1]; $id_saison = $pool->getSaisonID($id_pool); $periode = $pool->getPeriode($id_pool, $id_saison); $pool->set_account_stats($id_pool, $id_gerant, $id_saison); $pool_type = $pool->getPoolType($id_pool, $id_saison); $sess->setSessVar('authenticated', TRUE); // Set that authentication occurred. $sess->setSessVar('id_pool', $id_pool); // Store the ligue_id in the session $sess->setSessVar('user', $username); // Store the username in the session
$champ_id_pool = isset($_REQUEST['pool']) ? $_REQUEST['pool'] : ''; list($id_pool, $poolName) = split("_", $champ_id_pool); if (empty($user) || empty($pswd) || $id_pool == 0) { // Display error message when fields are not filled in. $message = 'Tous les champs doivent ×tre remplis.'; } else { // Connexion a la bd if (!$pool->dbConnect(strtolower($poolName))) { session_destroy(); // Delete session created (new DB_eSession) echo "<SCRIPT language=\"javascript\">"; echo "alert('Erreur lors de la connexion à la base de données. Réessayer plus tard.');"; echo "</SCRIPT>"; exit; } $rtn = $pool->validate_login($user, $pswd, $id_pool); $rtnL = explode(" ", $rtn); if ($rtnL[0] != "OK") { $message = $rtn; } else { $id_gerant = $rtnL[1]; $id_saison = $pool->getSaisonID($id_pool); $sess->setSessVar('authenticated', TRUE); // Set that authentication occurred. $sess->setSessVar('id_pool', $id_pool); // Store the ligue_id in the session $sess->setSessVar('id_saison', $id_saison); $sess->setSessVar('gerant', $rtnL[1]); $sess->setSessVar('poolName', $rtnL[3]); $sess->setSessVar('user', $user); // Store the username in the session