le 29/04/2013 à 20:29
PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans nom</title>
</head>
<body>
<font color="#FF0000"><center> Connexion </center></font>
</p> <center><table border="0">
<form name="f1" action="" method="POST">
<tr>
<td>Pseudo </td>
<td><input type="text" name="login_clt" /></td>
</tr>
<tr>
<td> Mot de passe </td>
<td><input type="password" name="pwd_clt" /></td>
</tr>
</br>
<tr>
<center><td colspan="2"><input type="submit" name="btn" value="Valider" /></td></center>
</tr>
</form>
</table></center>
<?php
$login=$_POST['login_clt'];
$pwd=$_POST['pwd_clt'];
session_start();
//$_SESSION['login']=$_POST['login_clt'];
//$_SESSION['pwd']=$_POST['pwd_clt'];
//connect to the db
$user = 'root';
$pswd = '';
$db = 'client';
$conn = mysql_connect('localhost', 'root', '');
mysql_select_db($db, $conn);
//run the query to search for the username and password the match
$query ="SELECT * FROM membre WHERE login_clt ='".$login."' AND pwd_clt = '".$pwd. "'";
$result = mysql_query($query) or die("Unable to verify user because : " . mysql_error());
if(mysql_num_rows($result) > 0)
{echo"bonjour $login";}
else
{echo "login ou mot de passe incorrect";}
?>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans nom</title>
</head>
<body>
<font color="#FF0000"><center> Connexion </center></font>
</p> <center><table border="0">
<form name="f1" action="" method="POST">
<tr>
<td>Pseudo </td>
<td><input type="text" name="login_clt" /></td>
</tr>
<tr>
<td> Mot de passe </td>
<td><input type="password" name="pwd_clt" /></td>
</tr>
</br>
<tr>
<center><td colspan="2"><input type="submit" name="btn" value="Valider" /></td></center>
</tr>
</form>
</table></center>
<?php
$login=$_POST['login_clt'];
$pwd=$_POST['pwd_clt'];
session_start();
//$_SESSION['login']=$_POST['login_clt'];
//$_SESSION['pwd']=$_POST['pwd_clt'];
//connect to the db
$user = 'root';
$pswd = '';
$db = 'client';
$conn = mysql_connect('localhost', 'root', '');
mysql_select_db($db, $conn);
//run the query to search for the username and password the match
$query ="SELECT * FROM membre WHERE login_clt ='".$login."' AND pwd_clt = '".$pwd. "'";
$result = mysql_query($query) or die("Unable to verify user because : " . mysql_error());
if(mysql_num_rows($result) > 0)
{echo"bonjour $login";}
else
{echo "login ou mot de passe incorrect";}
?>
</body>
</html>