Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'functions.php';
- if( isset($_POST["login"])){
- $username = $_POST["username"];
- $password = $_POST["password"];
- $result = mysqli_query($conn, "SELECT * FROM users_admin WHERE username = '$username'");
- if ( mysqli_num_rows($result) === 1 ) {
- $row = mysqli_fetch_assoc($result);
- if (password_verify($password, $row["password"]) ){
- header("Location: index.php");
- exit;
- }
- }
- $error = true;
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Login Administrator</title>
- </head>
- <body>
- <h1>Login Administrator</h1>
- <?php if (isset($error)) : ?>
- <p style="color: red; font-style: italic;">Username/Password Salah</p>
- <?php endif; ?>
- <form action="" method="post"></form>
- <ul>
- <li>
- <label for="username">Username :</label>
- <input type="text" name="username" id="username">
- </li>
- <li>
- <label for="password">Password :</label>
- <input type="password" name="password" id="password">
- </li>
- <li>
- <button type="submit" name="login">Login</button>
- </li>
- </ul>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement