Newer
Older
<?
function dispConnection(){
/////// BEGIN TABLE UP ///////
if ($_SESSION["user_right"] == 0) {
}
else {
$str .= dispConnectionDisconnect();
}
/////// BEGIN SPACE ///////
$str .= '<table><tr><td></td></tr></table>';
/////// 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);
<form name="saisie" method="post" action="index.php?connect=1§ion=Home">
<tr><td width="40%" class="small" align="center">Login</td></tr>
<tr><td width="60%" align="center"><input type="login" name="user_login" size="15" maxlength="15"></td></tr>
<tr><td width="40%" class="small" align="center">Pass</td></tr>
<tr><td width="60%" align="center"><input type="password" name="user_pass" size="15" maxlength="15"></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Uaimec"><br></td></tr>
</form>
';
else
$str .= "Pour vous connecter au site, <b>vous devez utiliser une connexion SSL</b>!";
$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 .= '
<tr>
<td>
Pour poster des news dans le forum vous devez vous enregistrer ici:
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="s\'enregistrer">
<br>
</form>
</td>
</tr>
';
$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 .= '
<tr>
<td>
Pour personnaliser votre profil ou emprunter du matos, vous devez vous enregistrer ici:
</td>
</tr>
<tr>
<td colspan="2" align="center">
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<input type="submit" value="s\'enregistrer">
<br>
</form>
</td>
</tr>
';
$str .= dispTableEnd();
return $str;
}
function dispConnectionProfile() { /////// CONNECTION PROFIL ///////
$str = dispTableBegin("p r é f é r e n c e", "30", 1);
$str .= '
<tr>
<td>
Pour modifier votre profil:
</td>
</tr>
<tr>
<td colspan="2" align="center">
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<input type="submit" value="Préférence">
<br>
</form>
</td>
</tr>
';
$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 .='
<form name="saisie" method="post" action="index.php?connect=-1§ion=Home">
<tr><td width="40%" class="small" align="center"> <b>Salut à toi
'.$user["user_pseudo"].'
</b></td></tr>
<!--
<tr><td width="40%" class="small" align="center">Status: <b>
'.get_right_name($user["user_right"]).'
</b></td></tr>
<tr><td width="40%" class="small" align="center">Rights: <b>
'.get_right_name($_SESSION["user_right"]).'
</b></td></tr>
-->
<tr><td width="40%" class="small" align="center">
'.$user["user_comment"].'
</td></tr>
<tr><td></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Déconnecter"><br></td></tr>
</form>
';
$str .= dispTableEnd();
return ($str);
}
Seblu
committed
$_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 {
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
}
}
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";
or die("Query failed");
$result = getAllBlacksite();
// random un peu porc pour les fake sites.
$cpt = 0;
while ($blacksite = mysql_fetch_array($result)) {
$randsite = rand (1, $cpt);
$result = getOneBlacksiteById($tabsite[$randsite]);
$blacksite = mysql_fetch_array($result);
echo '<META HTTP-EQUIV="REFRESH" CONTENT="0; URL='.$blacksite["blacksite_adress"].'"> '; // 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)) {
$randsite = rand (1, $cpt);
$result = getOneBlacksiteById($tabsite[$randsite]);
$blacksite = mysql_fetch_array($result);
echo '<META HTTP-EQUIV="REFRESH" CONTENT="0; URL='.$blacksite["blacksite_adress"].'"> '; // automatique redirection
}