-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvl_user.php
More file actions
68 lines (59 loc) · 1.52 KB
/
vl_user.php
File metadata and controls
68 lines (59 loc) · 1.52 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
<?php
session_start();
include "koneksi.php";
$Username = $_POST["Username"];
$Password = $_POST["Password"];
$query = mysqli_query ($konek, "SELECT * FROM user WHERE Username='$Username' AND Password='$Password'");
// Validasi Login
if ($_POST){
$queryuser = mysqli_query ($konek, "SELECT * FROM user WHERE Username='$Username'");
$user = mysqli_fetch_array ($queryuser);
if($user){
if (password_verify($Password, $user["Password"])){
$_SESSION["Username"] = $user["Username"];
$_SESSION["Password"] = $user["Password"];
$_SESSION["Id_Usergroup_User"] = $user["Id_Usergroup_User"];
$_SESSION["Id_User"] = $user["Id_User"];
$_SESSION["Foto"] = $user["Foto"];
$_SESSION["Login"] = true;
if ($_SESSION["Id_Usergroup_User"] == 1){
header ("Location: 1/index.php");
exit();
}
else if($_SESSION["Id_Usergroup_User"] == 2){
header ("Location: 2/index.php");
exit();
}
else if($_SESSION["Id_Usergroup_User"] == 3){
header ("Location: 3/index.php");
exit();
}
else{
header("Location :pagenotfound.php");
exit();
}
}
else
{
header ("Location: index.php?Err=4");
exit();
}
}
else if (empty ($Username) && empty ($Password)){
header ("Location: index.php?Err=1");
exit();
}
else if(empty ($Username)){
header ("Location: index.php?Err=2");
exit();
}
else if(empty ($Password)){
header ("Location: index.php?Err=3");
exit();
}
else{
header ("Location: index.php?Err=5");
exit();
}
}
?>