-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
77 lines (61 loc) · 2.53 KB
/
index.php
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
<!DOCTYPE html>
<html>
<head>
<Title>AUTHENTIFICATION</Title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<div class="container">
<header>
<h1 class="text-center">AUTHENTIFICATION</h1>
<header>
<form action='#' method='POST'>
<div class="form-group">
<input type="text" name="login" class="form-control" id="login" placeholder="Enter votre login">
</div>
<div class="form-group">
<input type="password" name="password" class="form-control" id="password" placeholder="Password">
</div>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Check me out</label>
</div>
<button type="submit" name="connexion" class="btn btn-primary">Connexion</button>
</div>
</form>
<?php
$fp =fopen('aduser.txt','r');
if (isset ($_POST['connexion']))
{
$login=$_POST['login'];
$password=$_POST['password'];
$lp=false;
while (!feof($fp)){
$ligne=trim(fgets($fp));
$user=explode(",",$ligne);
if($user[0]==$login && $user[6]==$password){
$lp=true;
$profil=$user[4];
if($profil=="admin"){
header("Location:Menuadministrateur.php");
}
else{
header("Location: acceuil.php");
}
}
}
fclose($fp);
/*if($lp==true){
if($profil=="admin"){
header("Location:Menuadministrateur.php");
}
else{
header("Location: acceuil.php");
}*/
if($lp==false){
echo"login ou mot de pass incorrect";
}
}
?>
</body>
</html>