Ticker

6/recent/ticker-posts

Membuat Login Dengan PHP dan MySQLi index.php

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Halaman Login</title>

<!-- Css Bootstrap -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">

<!-- JS Bootstrap -->
<script type="text/javascript" src="assets/js/bootstrap.bundle.min.js"></script>

</head>
<body>
<div class="container">
<h2>Halaman Login</h2>
<br/>
<!-- cek pesan notifikasi -->
<?php 
if(isset($_GET['pesan'])){
if($_GET['pesan'] == "gagal"){
echo "Login gagal! username dan password salah!";
}else if($_GET['pesan'] == "logout"){
echo "Anda telah berhasil logout";
}else if($_GET['pesan'] == "belum_login"){
echo "Anda harus login untuk mengakses halaman admin";
}
}
?>
<form method="post" action="aksi_login.php">
<div class="form-group mb-3">
<label>Username</label>
<input type="text" class="form-control" name="username" required>
</div>

<div class="form-group mb-3">
<label>Password</label>
<input type="password" class="form-control" name="password" required>
</div>

<div class="form-group mb-3">
<button type="submit" class="btn btn-primary">Login</button>
</div>
</form>
</div>
</body>
</html>

Posting Komentar

0 Komentar