Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include 'inc/koneksi.php';
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Login</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
- <link rel="stylesheet" href="css/styles.css">
- </head>
- <body>
- <section>
- <div class="container">
- <div class="row">
- <div class="col-md-4 col-md-offset-4 login-form">
- <h2 class="text-center">Login</h2>
- <form action="" method="POST">
- <div class="form-group">
- <label for="username">Nama</label>
- <input type="text" class="form-control" name="username">
- </div>
- <div class="form-group">
- <label for="password">Password</label>
- <input type="password" class="form-control" name="password">
- </div>
- <div class="form-group">
- <input type="submit" value="Log in" class="btn btn-primary" name="login">
- </div>
- <p><a href="">Lupa password Anda?</a></p>
- </form>
- <?php
- $user = @$_POST['username'];
- $pass = @$_POST['password'];
- $login = @$_POST['login'];
- if ($login) {
- if ($user == "" || $pass = "") {
- echo "<script>alert('Username atau Password tidak boleh kosong');</script>";
- } else {
- $query = mysql_query("SELECT * FROM tb_login WHERE username = '$user' AND password = '$pass'") or die(mysql_error());
- $check_login = mysql_num_rows($query);
- if ($check_login >= 1) {
- echo "Login Berhasil";
- } else {
- echo "Login Gagal";
- }
- }
- }
- ?>
- </div>
- </div>
- </div>
- </section>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement