'; /////// BEGIN TABLE DOWN /////// if ($_SESSION["user_right"] == "ANONYM") { // $str .= dispConnectionRegister(); // HIDE WAITING FORUM } else if ($_SESSION["user_right"] == "EPI") { // $str .= dispConnectionEpiRegister(); // HIDE WAITING REGISTER PAGE } else { // $str .= dispConnectionProfile(); // HIDE WAITING EDIT PROFIL } echo $str; } function dispConnectionLogin() { /////// CONNECTION LOGIN /////// $str = dispTableBegin("c o n n e x i o n", "30", 1); if ($_SERVER['HTTPS'] == "on") $str .= '
Login Pass
'; else $str .= "Pour vous connecter au site, vous devez utiliser une connexion SSL!"; $str .= dispTableEnd(); return ($str); } function dispConnectionRegister() { /////// CONNECTION REGISTER /////// $str = dispTableBegin("s ' e n r e g i s t r e r", "30", 1); $str .= ' Pour poster des news dans le forum vous devez vous enregistrer ici:

'; $str .= dispTableEnd(); return ($str); } function dispConnectionEpiRegister() { /////// CONNECTION EPI REGISTER /////// $str = dispTableBegin("s ' e n r e g i s t r e r", "30", 1); $str .= ' Pour personnaliser votre profil ou emprunter du matos, vous devez vous enregistrer ici:

'; $str .= dispTableEnd(); return $str; } function dispConnectionProfile() { /////// CONNECTION PROFIL /////// $str = dispTableBegin("p r é f é r e n c e", "30", 1); $str .= ' Pour modifier votre profil:

'; $str .= dispTableEnd(); return $str; } function dispConnectionDisconnect() { /////// CONNECTION PROFIL /////// $ID = $_SESSION["user_id"]; $result = getOneUserById($ID); $user = mysql_fetch_array($result); $str = dispTableBegin("d é c o n n e c t e r", "30", 1); $str .='
Salut à toi '.$user["user_pseudo"].' '.$user["user_comment"].'
'; $str .= dispTableEnd(); return ($str); } // Disconnect user function userDisconnect(){ $_SESSION["user_right"] = 0; $_SESSION["user_id"] = 0; } function checkUser($Check_Login, $Check_Pass){ $result_login = getOneUserByName($Check_Login); $result_pseudo = getOneUserByPseudo($Check_Login); // MD5 $md5_Pass = stripslashes($Check_Pass); $md5_Pass = md5($md5_Pass); if (mysql_num_rows($result_login)){ $user = mysql_fetch_array($result_login); if ($user["user_login"] == $Check_Login && $user["user_pass"] == $md5_Pass ) { $_SESSION["user_right"] = $user["user_right"]; $_SESSION["user_id"] = $user["user_id"]; return; } } else if (mysql_num_rows($result_pseudo)){ $user = mysql_fetch_array($result_pseudo); if ($user["user_pseudo"] == $Check_Login && $user["user_pass"] == $md5_Pass ) { $_SESSION["user_right"] = $user["user_right"]; $_SESSION["user_id"] = $user["user_id"]; return; } } if (yp_check($Check_Login, $Check_Pass)) { if ($user["user_login"] == $Check_Login){ $_SESSION["user_right"] = $user["user_right"]; $_SESSION["user_id"] = $user["user_id"]; } else { if (!check_blacklist($Check_Login)) { $_SESSION["user_right"] = 3; $_SESSION["user_id"] = 0; } else { $_SESSION["user_right"] = -1; } } return; } } function yp_check($login, $passwd, $domain = "", $map = "") { /* * first of all, if the domain is not specified, we need * to retrieve the default yp domain */ //if ($domain == "") // { // $domain = yp_get_default_domain(); // } /* * if the map is not specified, we set it to * passwd.byname */ if ($map == "") { $map = "socks"; } /* * then we try to find the yp entry corresponding to the * login */ $entry = @yp_match($domain, $map, $login); /* if the login doesn't exist, yp_match return FALSE */ if ($entry == FALSE) { return (FALSE); } /* * next we split the obtained line, we only need the * crypted password */ $good_passwd = $entry; /* * $good_passwd is a crypted password, and with is salt * (the 2 first chars), we can crypt the submitted * password */ $salt = substr($good_passwd, 0, 2); $submitted_passwd = crypt($passwd, $salt); /* * finally, we have to check if the two crypted * passwords match and return the result */ return (strcmp($good_passwd, $submitted_passwd) == 0); } function check_blacklist($Check_Login) { ////// CHECK IF BLACKLISTED ////// $result = getOneBlacklistByLogin($Check_Login); if (mysql_num_rows($result)){ $blacklist = mysql_fetch_array($result); $try = $blacklist["blacklist_try"] + 1; $query = " UPDATE `blacklist_db` "; $query .= " SET `blacklist_try` = '$try' "; $query .= " WHERE `blacklist_login` = '$Check_Login' LIMIT 1"; mysql_query($query) or die("Query failed"); $result = getAllBlacksite(); // random un peu porc pour les fake sites. $cpt = 0; while ($blacksite = mysql_fetch_array($result)) { $cpt++; $tabsite[$cpt] = $blacksite["blacksite_id"]; } $randsite = rand (1, $cpt); $result = getOneBlacksiteById($tabsite[$randsite]); $blacksite = mysql_fetch_array($result); echo ' '; // automatique redirection return (1); } return (0); } function go_random_blacksite() { $result = getAllBlacksite(); // random un peu porc pour les fake sites. $cpt = 0; while ($blacksite = mysql_fetch_array($result)) { $cpt++; $tabsite[$cpt] = $blacksite["blacksite_id"]; } $randsite = rand (1, $cpt); $result = getOneBlacksiteById($tabsite[$randsite]); $blacksite = mysql_fetch_array($result); echo ' '; // automatique redirection } ?>