1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
<?
session_start();
if ($_POST['username']) {
if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
include('header.php');
echo "<br><br>Mauvais code de sécurité... ";
include('footer.php');
exit();
}
//Vérification de l'envoi du nom d'utilisateur et mot de passe.
require('funciones.php');
$username=uc($_POST['username']);
$password=uc($_POST['password']);
if ($password==NULL) {
echo "Mot de pass éronné";
}else{
require('config.php');
$query = mysql_query("SELECT username,password FROM tb_users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['password'] != $password) {
echo "Mauvais pseudo";
}else{
$query = mysql_query("SELECT username,password FROM tb_users WHERE username = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
mysql_close($con);
$nicke=$row['username'];
$passe=$row['password'];
//Dure cookie 90 jours.
setcookie("usNick",$nicke,time()+7776000);
setcookie("usPass",$passe,time()+7776000);
$lastlogdate=time();
$lastip = getRealIP();
require('config.php');
$querybt = "UPDATE tb_users SET lastlogdate='$lastlogdate', lastiplog='$lastip' WHERE username='$nicke'";
mysql_query($querybt) or die(mysql_error());
mysql_close($con);
?>
<META HTTP-EQUIV="REFRESH" CONTENT="0;URL=members.php">
<?
}
}
}else{
?>
<? include('header.php'); ?>
<h3>Conexion</h3>
<br />
<a href="register.php">Nouvel utilisateur membre gratuit</a>
<br>
<a href="recoverpwd.php">Mot de pass perdu?</a>
<br><br>
<div align="center"><div id="form">
<fieldset>
<legend>Pseudo</legend>
<form action='login.php' method='POST'>
<table width="400" border="0" align="center">
<tr>
<td width="150" align="left"><p><label>Pseudo</label></p></td>
<td width="250" align="left"><input type='text' size='15' maxlength='25' name='username' autocomplete="off"value="" tabindex="1" /></td>
</tr>
<tr>
<td width="150" align="left"><p><label>Mot de pass</label></p></td>
<td width="250" align="left"><input type='password' size='15' maxlength='25' name='password' autocomplete="off" value="" tabindex="2" /></td>
</tr>
<tr>
<td width="150" align="left"><p><label>Code de securité </label></p></td>
<td width="250" align="left"><input type='text' size='3' maxlength='3' name='code' autocomplete="off" class="securitycode" value="" tabindex="3" /></td>
</tr>
<tr>
<td width="150" align="left"> </td>
<td width="250" align="left"><img src="image.php?<?php echo $res; ?>" /></td>
</tr>
<tr>
<td width="150" align="left"> </td>
<td width="250" align="right"><input type="submit" value="Conexion" class="submit" tabindex="4" />
</td>
</tr>
</table>
</form>
</fieldset>
</div></div>
<? include('footer.php'); ?>
<?
}
?> |