Advertisement
Guest User

cek_login

a guest
Sep 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $query = new mysqli('localhost', 'root', '', 'akademik');
  5.  
  6. $username = $_POST['username'];
  7. $password = $_POST['password'];
  8.  
  9. $data = mysqli_query($query, "SELECT * FROM admin where username='$username' and password='$password' ") or die(mysqli_error($query));
  10.  
  11. $cek = mysqli_num_rows($data);
  12.  
  13. if($cek > 0){
  14.     $_SESSION['username'] = $username;
  15.     $_SESSION['status'] = $login;
  16.     header('location:session.php');
  17. }
  18. else{
  19.     header('location:index.php?pesan=gagal');
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement