Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
97 lines (95 loc) · 3.08 KB
/
Copy pathindex.php
File metadata and controls
97 lines (95 loc) · 3.08 KB
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
<?php
session_start();
include 'Admin/config/dbcon.php';
if(isset($_POST['submit'])) {
$useremail = $_POST['user_email'];
$password = $_POST['user_password'];
$select = "SELECT * FROM users WHERE email = :useremail AND password = :password";
$qry = $conn->prepare($select);
$qry->bindParam(':useremail', $useremail);
$qry->bindParam(':password', $password);
$qry->execute();
$row = $qry->fetch(PDO::FETCH_ASSOC);
$state=$row['status'];
if($state==1){
if($row) {
$user_role = $row['user_role'];
$user_name = $row['nom'];
$_SESSION['user_role']= $row['user_role'];
$_SESSION['email']= $row['email'];
$_SESSION['nom']= $row['nom'];
$_SESSION['image']=$row['image'];
if($user_role == 'super admin') {
$_SESSION['admin_name'] = $user_name;
header('location: Admin/autre.php');
exit();
}
else if($user_role == 'ResponsableStock') {
$_SESSION['admin_name'] = $user_name;
header('location: Admin/respS.php');
exit();
}
else if($user_role == 'admin'){
header('location: Admin/admin.php');
exit();
}
else if($user_role == 'respo employee'){
header('location: Admin/respE.php');
exit();
}
else if($user_role == 'fournisseur'){
header('location: Admin/four.php');
exit();
}
} else {
$error[] = 'Incorrect email or password!';
}
<<<<<<< HEAD
else if($user_role == 'ResponsableStock') {
$_SESSION['admin_name'] = $user_name;
header('location: Admin/stock.php');
exit();
}
else if($user_role == 'admin'){
header('location: Admin/admin.php');
exit();
}
else if($user_role == 'respo employee'){
header('location: employee.php');
exit();
}
else if($user_role == 'fournisseur'){
header('location: Admin/four.php');
exit();
}
} else {
$error[] = 'Incorrect email or password!';
=======
>>>>>>> f96cd591bb9775460027a4aee5f33f63efbdad12
}
else {
header('location: Admin/accessdenied.php');
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>login form</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="form-container">
<form action="" method="POST">
<h3>login now</h3>
<input type="email" name="user_email" required placeholder="enter your email">
<input type="password" name="user_password" required placeholder="enter your password">
<input type="submit" name="submit" value="login now" class="form-btn">
</form>
</div>
</body>
</html>