Advertisement
Guest User

GDSDG

a guest
Aug 14th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2. include "koneksi2.php";
  3. $username = $_POST['names'];
  4. $password = $_POST['pass'];
  5. if (empty($username)){
  6. echo "<script>alert('Username belum diisi')</script>";
  7. echo "<meta http-equiv='refresh' content='1 url=index.html'>";
  8. }else if (empty($password)){
  9. echo "<script>alert('Password belum diisi')</script>";
  10. echo "<meta http-equiv='refresh' content='1 url=index.html'>";
  11. }else{
  12. session_start();
  13. $login = mysql_query("select * from users where username='$username' and password='$password'");
  14. if (mysql_num_rows($login) > 0){
  15. $_SESSION['username'] = $username;
  16. header("location:index.php");
  17. }else{
  18. echo "<script>alert('Username atau Password salah')</script>";
  19. echo "<meta http-equiv='refresh' content='1 url=index.html'>";
  20. }
  21. }
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement