Advertisement
nedfire

login.php

Dec 21st, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. include('connection.php');
  4. $ic=$_POST['icNum'];
  5. $pwd =$_POST['password'];
  6.  
  7. $login=mysqli_query($conn, "SELECT * FROM user WHERE
  8. icNum='$ic' and password= '$pwd' ");
  9.  
  10. if(mysqli_num_rows($login)>0) {
  11. session_start();
  12. $_SESSION['icNum'] = $ic;
  13. session_write_close();
  14.  
  15. echo '<script languages="javascript">' ;
  16.  
  17. echo 'alert("Login Success");';
  18. echo 'window.location.href="home.php";';
  19. echo '</script>';
  20. }else {
  21. echo '<script languages="javascript">' ;
  22. echo 'alert("Login error");';
  23. echo 'window.location.href="index.php";';
  24. echo '</script>';
  25. }
  26. mysqli_close($conn);
  27. //create connection to php=$
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement