Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include "koneksi.php";
- $username = $_POST["username"];
- $password = $_POST["password"];
- $result = mysqli_query($kon, "SELECT * FROM user WHERE username = '$username'");
- // cek username
- if( mysqli_num_rows($result) === 1) {
- // cek password
- $row = mysqli_fetch_assoc($result);
- if ( password_verify($password,$row["password"]) ) {
- // set session
- $_SESSION["login"] = true;
- header("location:admin/index.php");
- exit;
- }
- }
- $_SESSION["salah"] = "username/password salah!";
- header("location:index.php");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement