-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathval_user.php
More file actions
65 lines (56 loc) · 1.69 KB
/
val_user.php
File metadata and controls
65 lines (56 loc) · 1.69 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
<?php
session_start();
include "koneksi.php";
$Username = $_POST["username"];
$Password = md5($_POST['password']);
$query = mysqli_query ($konek, "SELECT * FROM tbl_user WHERE username='$Username' AND password='$Password'");
// Validasi Login
if ($_POST){
$queryuser = mysqli_query ($konek, "SELECT * FROM tbl_user WHERE username ='$Username' AND password='$Password'");
$row_akun = mysqli_fetch_array ($queryuser);
if($row_akun){
if (md5($Password, $row_akun["password"])){
$_SESSION['akun_username'] = $row_akun['username'];
$_SESSION['akun_password'] = $row_akun['password'];
$_SESSION['akun_id'] = $row_akun['id_user'];
$_SESSION['akun_nama'] = $row_akun['nama_user'];
$_SESSION['akun_previlleges'] = $row_akun['akses'];
$_SESSION['Login'] = true;
if ($_SESSION["akun_previlleges"] == "admin"){
header ("location: admin/index.php?".$_SESSION['akun_nama']."");
exit();
}else if ($_SESSION["akun_previlleges"] == "dokter"){
header ("location: dokter/index.php?".$_SESSION['akun_nama']."");
exit();
}else if ($_SESSION["akun_previlleges"] == "monitor"){
header ("location: monitor/index.php?".$_SESSION['akun_nama']."");
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();
}
}
?>