-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
104 lines (83 loc) · 3.15 KB
/
Copy pathindex.php
File metadata and controls
104 lines (83 loc) · 3.15 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
98
99
100
101
102
103
104
<?php
include('config.php');
include('functions.php');
$msg="";
if(isset($_POST['login'])){
$username=get_safe_value($_POST['username']);
$password=get_safe_value($_POST['password']);
$res=mysqli_query($con,"select * from users where username='$username'");
if(mysqli_num_rows($res)>0){
$row=mysqli_fetch_assoc($res);
$verify=password_verify($password,$row['password']);
if($verify==1){
$_SESSION['UID']=$row['id'];
$_SESSION['UNAME']=$row['username'];
$_SESSION['UROLE']=$row['role'];
if($_SESSION['UROLE']=='User'){
redirect('dashboard.php');
}else{
redirect('category.php');
}
}else{
$msg="Please enter valid password";
}
}else{
$msg="Please enter valid username";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="au theme template">
<meta name="author" content="Hau Nguyen">
<meta name="keywords" content="au theme template">
<!-- Title Page-->
<title>Login</title>
<link href="vendor/bootstrap-4.1/bootstrap.min.css" rel="stylesheet" media="all">
<!-- Main CSS-->
<link href="css/theme.css" rel="stylesheet" media="all">
</head>
<body class="animsition">
<div class="page-wrapper">
<div class="page-content--bge5">
<div class="container">
<div class="login-wrap">
<div class="login-content">
<div class="login-logo">
<a href="#">
<img src="images/icon/logo.png" alt="CoolAdmin">
</a>
</div>
<div class="login-form">
<form action="" method="post">
<div class="form-group">
<label>Username</label>
<input class="au-input au-input--full" type="text" name="username" placeholder="Username" required>
</div>
<div class="form-group">
<label>Password</label>
<input class="au-input au-input--full" type="password" name="password" placeholder="Password" required>
</div>
<button class="au-btn au-btn--block au-btn--green m-b-20" type="submit" name='login'>sign in</button>
</form>
<div id="msg"><?php echo $msg?></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Jquery JS-->
<script src="vendor/jquery-3.2.1.min.js"></script>
<!-- Bootstrap JS-->
<script src="vendor/bootstrap-4.1/popper.min.js"></script>
<script src="vendor/bootstrap-4.1/bootstrap.min.js"></script>
<!-- Main JS-->
<script src="js/main.js"></script>
</body>
</html>
<!-- end document-->