-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
76 lines (74 loc) · 2.62 KB
/
index.php
File metadata and controls
76 lines (74 loc) · 2.62 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
<?php
session_start();
include 'koneksi.php';
if(isset($_POST['username'])){
$usernsme = $_POST['username'];
$password = $_POST['password'];
$query = mysqli_query($conn, "SELECT * FROM login where username='$usernsme' and password='$password'");
if(mysqli_num_rows($query) > 0){
$data = mysqli_fetch_array($query);
$_SESSION['masuk'] = $data;
echo '<script> alert("Selamat datang di MHT Sensor, tempat Sensor aman & terpercaya!. '.$data['nama'].'");
location.href="menuawal.php"</script>';
} else {
echo '<script>alert("Username dan Password tidak sesuai, silahkan login kembali.");</script>';
}}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Login</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<style>
.login-form {
width: 340px;
margin: 50px auto;
font-size: 15px;
}
.login-form form {
margin-bottom: 15px;
background: #f7f7f7;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
padding: 30px;
}
.login-form h2 {
margin: 0 0 15px;
}
.form-control, .btn {
min-height: 38px;
border-radius: 2px;
}
.btn {
font-size: 15px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="login-form">
<form method="post">
<h2 class="text-center">Log in</h2>
<div class="form-group">
<input type="text" class="form-control" name="username"placeholder="username" required="required">
</div>
<div class="form-group">
<input type="password" class="form-control" name="password"placeholder="password" required="required">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block">Log in</button>
</div>
<div class="clearfix">
<label class="float-left form-check-label"><input type="checkbox"> Remember me</label>
<a href="#" class="float-right">Forgot Password?</a>
</div>
</form>
<p class="text-center"><a href="register.php">Create an Account</a></p>
</div>
</body>
</html>