Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. form login <html>
  2.  
  3. <head>
  4. <title>Halaman Bearanda Warga</title>
  5. <link rel="stylesheet" type="text/css" href="styles.css" >
  6. </head>
  7. <body>
  8.  
  9. <section><div class="box-login">
  10. <form action="" method="post">
  11.  
  12. <input type="text" name="email" placeholder="email"/><br>
  13. <input type="password" name="pass" placeholder="password"/><br>
  14. <input type="submit" name="masuk" value="masuk"/><br>
  15.  
  16. </form>
  17.  
  18. <?php
  19.  
  20. include "koneksi.php";
  21. if(isset($_POST['masuk'])){
  22. $cek = mysqli_query($conn, "SELECT * FROM user WHERE
  23. email = '".$_POST['email']."' AND password = '".$_POST['pass']."'");
  24. $hasil = mysqli_fetch_array($cek);
  25. $count = mysqli_num_rows($cek);
  26. $nama_user = $hasil['nama'];
  27. if($count > 0){
  28. session_start();
  29. $_SESSION['nama'] = $nama_user;
  30. header("location:index.php");
  31. }else{
  32. echo "gagal";
  33. }
  34. }
  35.  
  36. ?>
  37. </body>
  38.  
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement