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
| <?php
session_start();
include("connexion.php");
connect($host,$user,$mot_passe,$db_name);
?>
<?php
if(isset($_POST['t1']) && isset($_POST['t2']))
{
$login = addslashes($_POST['t1']);
$pass = addslashes($_POST['t2']);
$req1="SELECT * FROM user WHERE log='$login' AND pass='$pass'" ;
$rs1=mysql_query($req1);
$t=mysql_fetch_array($rs1);
if($t[3]==1){
session_register("authen_admin");
//echo"bonjour";
//$_SESSION['id']=$t[0];
header("location:admin_home.php");
}
else if($t[3]==2){
session_register("authen_user");
//echo"bonjour";
//$_SESSION['id']=$t[0];
header("location:user_home.php");
}
else{
header("location:index.php?erreur=707");
}
}
//echo $HTTP_POST_VARS['f2'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link href="css/style.css" rel="stylesheet">
<title></title>
<script language="javascript">
function test(){
if(document.f2.t1.value =="" ){
alert("Vérifier le nom d'utilisateur");
document.f2.t1.select();}
else if (document.f2.t2.value ==""){
alert("Vérifier votre mot de passe");
document.f2.t2.select();
}
else
document.f2.submit();
}
</script>
</head>
<body topmargin="0" leftmargin="0">
<table width="940" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" bgcolor="#FFFFFF" style="border-collapse: collapse">
<tr>
<td width="100%" align="left" valign="top">
<table WIDTH="790" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<tr>
<td COLSPAN="6"><img SRC="img/header.jpg" WIDTH="387" HEIGHT="94"></td>
</tr>
<tr>
<td COLSPAN="6"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="455" valign="top"><hr>
<table width="939" height="117" BORDER="0" CELLPADDING="0" CELLSPACING="0">
<tr>
<td align="center">
<form name="f2" action="index.php" method="post">
<p><span class="Style1">Nom d'utilisateur</span> <br>
<input name="t1">
<br>
<span class="Style1">Mot de passae</span><br>
<input name="t2" type="password">
</p>
<p><br>
<input type="button" value="Valider" onClick="test()">
<input type="reset" value="Annuler">
</p>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html> |
Partager