Guest User

Untitled

a guest
Jun 18th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. require("general.php");
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];
  5.  
  6. if($username != "" && $password != "" )
  7. {
  8. if(substr($username,0,6) == "Coder_") // A Coder Logging in
  9. {
  10. $username = substr($username,6);
  11. $tabel = "coders";
  12. }
  13. else // Regular Costumer
  14. {
  15. $tabel = "costumers";
  16. }
  17.  
  18. $q = mysql_query("SELECT * FROM `".$tabel."` WHERE login ='".mysql_escape_string($username)."'");
  19. $person = mysql_fetch_array($q);
  20.  
  21. if(md5($password) == $person['password']) // Correct Password
  22. {
  23. if($tabel == "coders")
  24. {
  25. $_SESSION['id'] = 0;
  26. $_SESSION['coder'] = $person['id'];
  27. }
  28. else
  29. {
  30. $_SESSION['id'] = $person['id'];
  31. }
  32.  
  33. //Redirection to Index.php
  34. header("Location: index.php", true, 306);
  35. }
  36. else{ echo("<h2>Username or Password is wrong!</h2>"); }
  37. }
  38. else{ echo("<h2>Username or Password is Empty!</h2>"); }
  39. ?>
Add Comment
Please, Sign In to add comment