-
Notifications
You must be signed in to change notification settings - Fork 1
/
login_page.php
73 lines (64 loc) · 2.2 KB
/
login_page.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
<!DOCTYPE html>
<html>
<head>
<title>Favorit System</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Custom Theme files -->
<link href="assets/css/styleLogin.css" rel="stylesheet" type="text/css" media="all" />
<!-- //Custom Theme files -->
<!-- web font -->
<link href="//fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i" rel="stylesheet">
<!-- //web font -->
</head>
<body>
<!-- main -->
<div class="main-w3layouts wrapper">
<h1>Favorit</h1>
<h2 style="text-align:center;font-size: 23px;font-weight: bold">Sistem Pengadaan Barang</h2>
<div class="main-agileinfo">
<div class="agileits-top">
<form action="#" method="post">
<input class="text" type="text" name="Username" placeholder="Username" required=""><br>
<input class="text" type="password" name="password" placeholder="Password" required=""><br>
<?php
if (isset($_POST['login'])) {
session_start();
include 'koneksi_model.php';
$user=$_POST['Username'];
$pass=($_POST['password']);
$sql= "SELECT id_user,username,password FROM user WHERE username='".$user."'";
$query= mysqli_query($conn,$sql);
#if (!$query) {
# printf("Error: %s\n", mysqli_error($conn));
# exit();
#}
$result= mysqli_fetch_array($query);
if (!empty($user || $pass)) {
if ($user==$result[1]) {
if ($pass==$result[2]) {
$_SESSION["sukses"]=1;
$_SESSION["username"]=$result[1];
$_SESSION["password"]=$result[2];
$_SESSION["id_user"]=$result[0];
header("location: mainMenu.php");
}else{
echo "<div class='errorNotif'>Password Salah</div>";
}
}else{
echo "<div class='errorNotif'>Username Salah</div>";
}
}else{
echo "<div class='errorNotif'>tidak boleh kosong</div>";
}
}
?>
<input type="submit" name="login" value="LOGIN">
</form>
</div>
</div>
</div>
<!-- //main -->
</body>
</html>