Guest User

Untitled

a guest
Nov 21st, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. include 'database.php';
  3.  
  4. session_start();
  5. $username=mysql_real_escape_string($_POST['username']);
  6. $password=mysql_real_escape_string($_POST['password']);
  7. $bool=true;
  8.  
  9. $query=mysql_query("SELECT * FROM employee WHERE username='$username'");
  10. $exists=mysql_num_rows($query);
  11. $table_employee="";
  12. $table_password="";
  13.  
  14. if($exists>0)
  15. {
  16. while($row=mysql_fetch_assoc($query))
  17. {
  18. $table_employee=$row['username'];
  19. $table_password=$row['password'];
  20. }
  21. if(($username==$table_employee)&&($password==$table_password))
  22. {
  23. if($password==$table_password)
  24. {
  25. $_SESSION['username']=$username;
  26. header("location: /technician/index.php");
  27.  
  28. }
  29. }
  30.  
  31. else
  32. {
  33. Print'<script>alert("Incorrect Username or Password!");</script>';
  34. Print'<script>window.location.assign("login.php");</script>';
  35. }
  36. }
  37.  
  38.  
  39. ?>
Add Comment
Please, Sign In to add comment