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
| <?php
session_start();
if(isset($_POST['submit'])){
$username=htmlspecialchars(trim($_POST['username']));
$password=htmlspecialchars(trim($_POST['password']));
$password=htmlspecialchars(trim($_POST['libelle']));
if($username && $password && $libelle){
$password=md5($password);
$connect=mysql_connect('localhost','root','');
mysql_select_db('phplogin');
$log=mysql_query("SELECT* FROM customers WHERE username='$username' AND password='$password' ");
$rows=mysql_num_rows($log);
if($rows==1){
$_SESSION['username']=$username;
header('Location:membre.php');
}else echo"Nom d'utilisateur ou Mot de passe incorrect";
}else echo"Veuillez saisir tous les champs";
}
?>
<!doctype>
<html>
<head>
<title> mini formulaire 2 </title>
<link rel="stylesheet" type="text/css" href="css/form.css" />
</head>
<body background="images/rouges.jpg">
<div >
<header>
</header>
<div align="center">
<div class="block">
<form name="form" method="post" action="login.php" >
<fieldset>
<label>
Identifiant</br><input type="text" name="username" class="pass"></br>
</label>
<label>
Mot de passe </br><input type="password" name="password" size="20" class="pass"></br>
</label>
Vous etes? </br><select name="libelle" class="pass">
<option selected> </option>
<option value="Client" <?php if($_POST['libelle']=='Client') {echo 'selected="selected"';} ?> >Client</option>
<option value="Technicien" <?php if($_POST['libelle']=='Client') {echo 'selected="selected"';}?> >Technicien</option>
</select></br>
<div>
<p><input type="submit" value="Connexion" name="submit" "class="envoyer"></p>
<p><input type="image" src="images/connexion-facebook.png" class=""></p>
<input type="image" src="images/connexion-google.png" class="envoyer">
</div>
</fieldset>
</div>
</div>
</body>
</html> |
Partager