Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Connect MySQL
- $host = "localhost";
- $db = "idhabblet_fs";
- $user = "idhabblet";
- $pass = "VO(OM&%F8&4,";
- try {
- $PDO = new PDO("mysql:host=".$host."; dbname=".$db."", "".$user."", "".$pass."");
- $PDO->query("SET NAMES utf8;");
- } catch (PDOException $e) {
- echo "Dados de conex達o ao MySQL est達o incorretas!";
- exit;
- }
- // Função FigureAvatar
- function figureAvatar($username) {
- global $PDO;
- $res = new stdClass();
- $figureAvatar = $PDO->prepare("SELECT figure FROM players WHERE username=:username LIMIT 1");
- $figureAvatar->bindValue("username", $username);
- $figureAvatar->execute();
- if(!$figureAvatar->rowCount() <= 0) {
- $res->figure = $figureAvatar->fetchObject()->figure;
- } else {
- $res->figure = "error.lg-3136-92";
- }
- return $res;
- }
- // GET's Avatar
- $username = filter_input(INPUT_GET, 'user', FILTER_SANITIZE_STRING);
- $dataUser = figureAvatar($username);
- $figure = $dataUser->figure;
- $action = filter_input(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
- $gesture = filter_input(INPUT_GET, 'gesture', FILTER_SANITIZE_STRING);
- $size = filter_input(INPUT_GET, 'size', FILTER_SANITIZE_STRING);
- $direction = filter_input(INPUT_GET, 'direction', FILTER_SANITIZE_STRING);
- $head_direction = filter_input(INPUT_GET, 'head_direction', FILTER_SANITIZE_STRING);
- $headonly = filter_input(INPUT_GET, 'headonly', FILTER_SANITIZE_STRING);
- $img_format = filter_input(INPUT_GET, 'img_format', FILTER_SANITIZE_STRING);
- // Definido Action
- if(empty($action)) {$action = "std";}
- // Definido Gesture
- if(empty($gesture)) {$gesture = "sml";}
- // Definido Size
- if(empty($size)) {$size = "b";}
- // Definido Direction
- if(empty($direction)) {$direction = 2;}
- // Definido Head Direction
- if(empty($head_direction)) {$head_direction = 3;}
- // Definido Headonly
- if(empty($headonly)) {$headonly = 0;}
- // Definido Img Format
- if(empty($img_format)) {$img_format = "gif";}
- // Definido Format IMG
- if($img_format == "png") {
- $img_format = "png";
- } else {
- $img_format = "gif";
- }
- header("Content-type: image/".$img_format);
- 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);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement