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
|
<? include("_connexion.php");
if(isset($_POST) && !empty($_POST['username']) && !empty($_POST['password'])) {
extract($_POST);
$sql = "select password from members where username='".$username."'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$data = mysql_fetch_assoc($req);
$url=$_SERVER['REQUEST_URI'];
if($data['password'] != $password)
{
header("Location: login.php");
echo "<h5>Mauvais pseudo ou mot de passe. Merci de recommencer</h5>";
exit;
}
else {
session_start();
$_SESSION['username'] = $username;
header("Location: $url");
}
}
mysql_close(); ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<title>Login : ouvir une session</title>
</head>
<body>
<table align="left" cellpadding="0" cellspacing="0" border="0" width="900">
<tr>
<td colspan="2">
<a href="default.php"><img src="img/logo.gif" align="absmiddle" border="0"></a>
</td>
</tr>
<tr>
<td colspan="2">
<h1>Ouvrir une session</h1>
</td>
</tr>
<tr>
<td colspan="2">
<h3>Entrez votre pseudo et votre mot de passe</h3>
</td>
</tr>
<tr>
<td width="50%" valign="top">
<table align="center" cellpadding="0" cellspacing="10" border="0" width="100%" >
<tr>
<td id="yellowtd">
<h2>Vous êtes déjà membre ?</h2>
<p>Entrez votre pseudo et votre mot de passe pour ouvrir une session. </p>
<form action="login.php" method='post'">
<table align="center" border="0">
<tr>
<td><p>Pseudo</p></td>
<td><input type="text" name="username" maxlength="20"></td>
</tr>
<tr>
<td><p>Mot de passe</p></td>
<td><input type="password" name="password" maxlength="20"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Ouvrir une session"><br />
<a href="pseudo_oublie.php">Mot de passe ou pseudo oublié ?</a></td>
</tr>
</table>
</form> |
Partager