Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require "config.php";
- if (isset($_COOKIE['login'])) {
- # code...
- if ($_COOKIE['login'] =='true') {
- # code...
- $_SESSION['username'] == true;
- }
- }
- $username = $_POST['username'];
- $password = $_POST['password'];
- $query=mysqli_query($koneksi, "SELECT * FROM users WHERE username='$username'");
- $h = mysqli_num_rows($query);
- $pw = mysqli_fetch_array($query);
- $pwnow = $pw['password'];
- if ($h>0) {
- # code...
- if(password_verify($password, $pwnow)){
- $_SESSION['username'] = $username;
- // if (isset($_POST['remember'])) {
- // # code...
- // setcookie('login', 'true', time() + 30);
- // }
- header("location: home.php");
- } else{
- echo '<script>
- alert ("PASSWORD SALAH");
- window.location.href="index.php";
- </script>';
- }
- }
- // else{
- // echo '<script>
- // alert ("LOGIN GAGAL");
- // window.location.href="index.php";
- // </script>';
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement