Advertisement
Guest User

Untitled

a guest
Oct 9th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2.  
  3. if(isset($_GET))
  4. {
  5. require_once("database.php");
  6.  
  7. if(isset($_GET['username']) && isset($_GET['password']) && isset($_GET['what']))
  8. {
  9. if(strlen($_GET['username']) > 0 && strlen($_GET['password']) > 0 && strlen($_GET['what']) > 0)
  10. {
  11. $username = htmlspecialchars($_GET['username']);
  12. $password = htmlspecialchars($_GET['password']);
  13. $what = $_GET['what'];
  14.  
  15. $available = array("id", "username", "password", "email");
  16.  
  17. if(in_array($what, $available))
  18. {
  19. $r = $database->prepare("SELECT ".$what." FROM clients_info WHERE username=:username AND password=MD5(:password)");
  20. $r->bindParam(":username", $username, PDO::PARAM_STR);
  21. $r->bindParam(":password", $password, PDO::PARAM_STR);
  22. $r->execute();
  23.  
  24. if($r->rowCount() == 0)
  25. header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
  26. else
  27. $data = $r->fetch(PDO::FETCH_OBJ)->$what;
  28. }
  29. }
  30. }
  31.  
  32. if(isset($data))
  33. print ($data);
  34. else
  35. {
  36. header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
  37. exit(0);
  38. }
  39.  
  40. exit(0);
  41. }
  42.  
  43. header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
  44.  
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement