-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
101 lines (88 loc) · 3.04 KB
/
index.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
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
<?php
require 'config.php';
session_start();
// $conn = mysqli_connect("localhost", "root", "123", "pkm") or die("koneksi gagal");
if (isset($_SESSION['login'])) {
header("Location: main.php");
}
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM `login` WHERE username='$username' AND password='$password'";
$result = mysqli_query($conn, $sql);
if ($result->num_rows > 0) {
$row = mysqli_fetch_assoc($result);
$_SESSION['username'] = $row['username'];
$_SESSION['login'] = true;
header("Location: main.php");
} else {
echo "<script>alert('User atau Password Anda salah. Silahkan coba lagi!')</script>";
}
}
?>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<title>TwinGuard</title>
<style>
html {
max-width: 650px;
margin-left: auto;
margin-right: auto;
/* border-width: thin; */
/* border-style: dashed; */
/* border-color: crimson; */
min-height: 100%;
/* box-sizing: border-box; */
}
body {
/* background-color: #ff4081ff; */
text-align: center;
font-family: 'Lexend Deca', sans-serif;
}
h1 {
color: blue;
}
img {
display: inline-block;
width: 83%;
margin: 0 auto;
}
/* @media only screen and (max-width: 650px) {
img {
width: 100%;
}
} */
/* img {
display: block;
margin-left: auto;
margin-right: auto;
width: 85%;
} */
/* p {color: red;} */
</style>
</head>
<body>
<center><img src="images/twinguard.png"></center>
<form action="" method="post" enctype="multipart/form">
<div class="input-field">
<label class="label">Username:</label>
<input type="text" class="input col-5" name="username" required autocomplete="off">
</div>
<div class="input-field mb-2">
<label class="label">Password:</label>
<input type="password" class="input mt-2 col-5" name="password" required>
</div>
<div class="input-field mt-5">
<!-- <a type="submit" class="mx-3 btn btn-outline-success" name="submit">Masuk</button> -->
<button name="submit" class="btn mx-3 btn-outline-success">Masuk</button>
<a class="btn btn-outline-primary" aria-current="page" href="register.php">Daftar</a>
</div>
</form>
</body>
</html>