Advertisement
Guest User

tylin

a guest
Jan 11th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <?php
  2.  
  3. // Connect MySQL
  4.  
  5. $host = "localhost";
  6. $db = "idhabblet_fs";
  7. $user = "idhabblet";
  8. $pass = "VO(OM&%F8&4,";
  9.  
  10. try {
  11. $PDO = new PDO("mysql:host=".$host."; dbname=".$db."", "".$user."", "".$pass."");
  12. $PDO->query("SET NAMES utf8;");
  13. } catch (PDOException $e) {
  14. echo "Dados de conex達o ao MySQL est達o incorretas!";
  15. exit;
  16. }
  17.  
  18. // Função FigureAvatar
  19.  
  20. function figureAvatar($username) {
  21. global $PDO;
  22. $res = new stdClass();
  23. $figureAvatar = $PDO->prepare("SELECT figure FROM players WHERE username=:username LIMIT 1");
  24. $figureAvatar->bindValue("username", $username);
  25. $figureAvatar->execute();
  26. if(!$figureAvatar->rowCount() <= 0) {
  27. $res->figure = $figureAvatar->fetchObject()->figure;
  28. } else {
  29. $res->figure = "error.lg-3136-92";
  30. }
  31. return $res;
  32. }
  33.  
  34. // GET's Avatar
  35. $username = filter_input(INPUT_GET, 'user', FILTER_SANITIZE_STRING);
  36. $dataUser = figureAvatar($username);
  37. $figure = $dataUser->figure;
  38. $action = filter_input(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
  39. $gesture = filter_input(INPUT_GET, 'gesture', FILTER_SANITIZE_STRING);
  40. $size = filter_input(INPUT_GET, 'size', FILTER_SANITIZE_STRING);
  41. $direction = filter_input(INPUT_GET, 'direction', FILTER_SANITIZE_STRING);
  42. $head_direction = filter_input(INPUT_GET, 'head_direction', FILTER_SANITIZE_STRING);
  43. $headonly = filter_input(INPUT_GET, 'headonly', FILTER_SANITIZE_STRING);
  44. $img_format = filter_input(INPUT_GET, 'img_format', FILTER_SANITIZE_STRING);
  45.  
  46. // Definido Action
  47. if(empty($action)) {$action = "std";}
  48.  
  49. // Definido Gesture
  50. if(empty($gesture)) {$gesture = "sml";}
  51.  
  52. // Definido Size
  53. if(empty($size)) {$size = "b";}
  54.  
  55. // Definido Direction
  56. if(empty($direction)) {$direction = 2;}
  57.  
  58. // Definido Head Direction
  59. if(empty($head_direction)) {$head_direction = 3;}
  60.  
  61. // Definido Headonly
  62. if(empty($headonly)) {$headonly = 0;}
  63.  
  64. // Definido Img Format
  65. if(empty($img_format)) {$img_format = "gif";}
  66.  
  67. // Definido Format IMG
  68. if($img_format == "png") {
  69. $img_format = "png";
  70. } else {
  71. $img_format = "gif";
  72. }
  73.  
  74. header("Content-type: image/".$img_format);
  75.  
  76. echo ("https://avatar-retro.com/habbo-imaging/avatarimage?figure=".$figure."&gesture=".$gesture."&action=".$action."&size=".$size."&direction=".$direction."&head_direction=".$head_direction."&headonly=".$headonly."&img_format=".$img_format);
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement