Guest User

Untitled

a guest
Dec 6th, 2017
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. include "koneksi.php";
  6.  
  7. if ( isset($_POST['username']) && isset($_POST['password'])){
  8.  
  9. $username = $_POST['username'];
  10. $password = md5($_POST['password']);
  11.  
  12. $sql = "SELECT id FROM user WHERE username='$username' AND password='$password' LIMIT 1";
  13.  
  14. $qry = mysqli_query($kon,$sql);
  15. $hsl = mysqli_fetch_array($qry);
  16. if ( mysqli_num_rows($qry) == 1){
  17. $_SESSION['userid'] = $hsl[0];
  18. $_SESSION['username'] = $hsl[1];
  19. header('location:admin/');
  20. } else {
  21. header('location:index.php?error='.base64_encode('Username dan Password salah!'));
  22. }
  23.  
  24. }
  25.  
  26. else{
  27. header('location:index.php');
  28. exit;
  29. }
  30.  
  31.  
  32. ?>
Add Comment
Please, Sign In to add comment