Guest User

Untitled

a guest
May 8th, 2017
53
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.  
  3. include_once('DbConn.php');
  4. include_once('Users.php');
  5. $response="";
  6.  
  7. $db= new DBConn();
  8. if (isset($_POST['user']) && isset($_POST['pass'])) {
  9. if (CheckCredentials()) {
  10. $response="Log In Succesful";
  11. Redirect();
  12. }
  13. else{
  14. $response="User No exists";
  15. }
  16. }
  17. else {
  18. $response= "No Button Clicked";
  19.  
  20. }
  21.  
  22. echo $response;
  23.  
  24.  
  25.  
  26.  
  27. function CheckCredentials(){
  28. $Users= new User();
  29. $user=$_POST['user'];
  30. $pass=$_POST['pass'];
  31. return $Users->CheckCredentials($user,$pass);
  32. }
  33. function UserExist(){
  34. $Users= new User();
  35. $user=$_POST['user'];
  36. return $Users->UserExists($user);
  37. }
  38.  
  39. function Redirect(){
  40. $page="http://localhost:8080/Projects/Pentalog/Mod2Tema2/signIn.html";
  41. header('Location: '.$page);
  42. exit;
  43. }
  44.  
  45. function GenerateToken(){
  46. $token="";
  47. if (CheckCredentials())
  48. {
  49. $token= md5($_POST['user'].$_POST['pass']);
  50. }
  51. return $token;
  52. }
  53.  
  54. ?>
Add Comment
Please, Sign In to add comment