Habboon Imager

Discussion in 'Web Design' started by Mauvros, Feb 25, 2016.

  1. Mauvros

    Mauvros PhD in dumbfuckery Member

    Messages:
    662
    Likes:
    374
    Local Time:
    9:40 AM
    Boon:
  2. Matheos
  3. Working on this, paused for a while but back at it again since Ecko found a way to get past Cloudlfare, and kindly shared the method with me. As of right now the imager will only grab the simplest of avatars, but I'm working on adding a few radio checkboxes into the form to allow for sit, wave, drinks, etc etc.

    Working demo can be found here, or if you're picky about visiting external websites, there's a picture in the spoiler.

    [​IMG]

    Type in a username, press submit. If some fansites or anyone else plans on using this then I'll share the code with you providing youre not a douche.

    Not entirely sure why I created this, but heck I have deadly amounts of free time and it's fun.
     
  4. White

    White ur gross Member

    Messages:
    137
    Likes:
    40
    Local Time:
    7:40 AM
    Screenshot_22.png
    When your avatar is half naked. But well done on making a successful imager.
     
    Mauvros likes this.
  5. Mauvros

    Mauvros PhD in dumbfuckery Member

    Messages:
    662
    Likes:
    374
    Local Time:
    9:40 AM
    Boon:
  6. Matheos
  7. Is your avatar naked in game or is that an error? If it's an error not sure if I can do anything about it since the code simply grabs the clothing code from Boon, and ties to to Habbo.com.br.
     
  8. White

    White ur gross Member

    Messages:
    137
    Likes:
    40
    Local Time:
    7:40 AM
    It's fine in game, not sure what its like on home page as it doesn't show for me, but could be an error from boon's side.
     
  9. Mauvros

    Mauvros PhD in dumbfuckery Member

    Messages:
    662
    Likes:
    374
    Local Time:
    9:40 AM
    Boon:
  10. Matheos
  11. Full script is here, opinions on the code, let me know.

    PHP:
    <?php

        
    // Matheos @ Boonforums / Boon.pw
        // Simple Imager script.

        // Define variables from $_GET.

        
    $user filter_input(INPUT_GET'user'FILTER_SANITIZE_STRING);
        
    $action $_GET["action"];
        
    $gesture $_GET["gesture"];
        
    $head_direction $_GET["head_direction"];
        
    $body_direction $_GET["direction"];
        
    $size $_GET["size"];
      
        
    // Get the basic avatar
      
            
    echo "<img src='https://www.habbo.com.br/habbo-imaging/avatarimage?hb=img&figure=";
            
    system("/usr/bin/curl -s --ciphers ecdhe_ecdsa_aes_128_sha https://game.boon.pw/habbo-imaging/avatarimage_figure.php?username=" .$user);
          
        
    // Set the actions
      
      
        // What is the setting set at in $action, either wlk/lay/sit/wav/drk/crr
      
            
    if($action === "wlk"){          // Walk
                
    echo "&action=wlk";
            } elseif(
    $action === "lay") { // Lay down
                
    echo "&action=lay";
            } elseif(
    $action === "sit") { // Sit down
                
    echo "&action=sit";
            } elseif(
    $action === "wav") { // Waves
                
    echo "&action=wav";
            }
          
        
    // Drinking / Eating certain hand items
          
            
    elseif($action === "drk=1") { // Drink a Drink
                
    echo "&action=drk=1";
            } elseif(
    $action === "drk=2") { // Eat a Carrot
                
    echo "&action=drk=2";
            } elseif(
    $action === "drk=3") { // Eat a Ice Cream
                
    echo "&action=drk=3";
            } elseif(
    $action === "drk=5") { // Drink a Cola
                
    echo "&action=drk=5";
            } elseif(
    $action === "drk=6") { // Drink a Coffee
                
    echo "&action=drk=6";
            } elseif(
    $action === "drk=9") { // Drink a Love Potion
                
    echo "&action=drk=9";
            }
          
        
    // Holding certain hand items
      
            
    elseif($action === "crr=1") { // Hold a Drink
                
    echo "&action=crr=1";
            } elseif(
    $action === "crr=2") { // Hold a Carrot
                
    echo "&action=crr=2";
            } elseif(
    $action === "crr=3") { // Hold a Ice Cream
                
    echo "&action=crr=3";
            } elseif(
    $action === "crr=5") { // Hold a Cola
                
    echo "&action=crr=5";
            } elseif(
    $action === "crr=6") { // Hold a Coffee
                
    echo "&action=crr=6";
            } elseif(
    $action === "crr=9") { // Hold a Love Potion
                
    echo "&action=crr=9";
            }
          
        
    // What facial expression is set in $gesture, either sml/sad/agr/srp/eyb/spk
      
            
    if($gesture === "sml"){          // Smiling face
                
    echo "&gesture=sml";
            } elseif(
    $gesture === "sad"){ // Sad face
                
    echo "&gesture=sad";
            } elseif(
    $gesture === "agr"){ // Angry face
                
    echo "&gesture=agr";
            } elseif(
    $gesture === "srp"){ // Surprised face
                
    echo "&gesture=srp";
            } elseif(
    $gesture === "eyb"){ // Sleeping / Closed eyes
                
    echo "&gesture=eyb";
            } elseif(
    $gesture === "spk"){ // Speaking / Mouth open
                
    echo "&gesture=spk";
            }

        
    // Body Directions, Going from 0 to 8,
          
            
    if($body_direction === "1"){
                echo 
    "&direction=1";
            } elseif(
    $body_direction === "2"){
                echo 
    "&direction=2";
            } elseif(
    $body_direction === "3"){
                echo 
    "&direction=3";
            } elseif(
    $body_direction === "4"){
                echo 
    "&direction=4";
            } elseif(
    $body_direction === "5"){
                echo 
    "&direction=5";
            } elseif(
    $body_direction === "6"){
                echo 
    "&direction=6";
            } elseif(
    $body_direction === "7"){
                echo 
    "&direction=7";
            } elseif(
    $body_direction === "8"){
                echo 
    "&direction=8";
            }
          
        
    // Head Directions, Going from 0 to 8,
      
            
    if($head_direction === "1"){
                echo 
    "&head_direction=1";
            } elseif(
    $head_direction === "2"){
                echo 
    "&head_direction=2";
            } elseif(
    $head_direction === "3"){
                echo 
    "&head_direction=3";
            } elseif(
    $head_direction === "4"){
                echo 
    "&head_direction=4";
            } elseif(
    $head_direction === "5"){
                echo 
    "&head_direction=5";
            } elseif(
    $head_direction === "6"){
                echo 
    "&head_direction=6";
            } elseif(
    $head_direction === "7"){
                echo 
    "&head_direction=7";
            } elseif(
    $head_direction === "8"){
                echo 
    "&head_direction=8";
            }
          
          
        
    // Size of the avatar image
      
            
    if($size === "s"){
                echo 
    "&size=s";
            } elseif(
    $size === "m"){
                echo 
    "&size=m";
            } elseif(
    $size === "l"){
                echo 
    "&size=l";
            }
      
      
        
    // All 'if' statements done, end the <img> tag
      
            
    echo "'>";
          
            
    // Later to add into ~ Maybe change into a function and then call it back with a form? IDs to remember:
            //
            // &headonly=1 <- Only the head
            // &action=wlk/lay/sit/wav/drk/crr <- Walk / Lay / Sit / Wave / Drink / Hold.

            // Matheos & Ecko ~ Boonforums
          
    ?>

    You use this normally like you would. So an example would be:

    www.example.com/imager.php?user=Matheos&action=drk=1&gesture=sml&direction=6&head_direction=6&size=m

    Haven't added headonly, but that'd take a few seconds.
     
  12. soaf

    soaf Registered User Member

    Messages:
    352
    Likes:
    43
    Local Time:
    2:40 AM
    Love the avatar imager! Keep up the good work :)
     
  13. Ecko

    Ecko Registered User Member

    Messages:
    35
    Likes:
    12
    Local Time:
    1:40 AM
    Boon:
  14. Ecko
  15. PHP:
    $action $_GET["action"];
    $gesture $_GET["gesture"];
    $head_direction $_GET["head_direction"];
    $body_direction $_GET["direction"];
    $size $_GET["size"];
    Please sanitize all input.
     
    Mauvros likes this.
  16. Nerd

    Nerd Ass Queen Senior Forum Staff

    Messages:
    1,578
    Likes:
    754
    Local Time:
    2:40 AM
    Boon:
  17. Mary
  18. It worked for me.
    [​IMG]
     
  19. Mauvros

    Mauvros PhD in dumbfuckery Member

    Messages:
    662
    Likes:
    374
    Local Time:
    9:40 AM
    Boon:
  20. Matheos
  21. Noice, Just adding in the forms at the moment to get the thing user friendly. Not caring much for design, someone else can worry about that.
     
  22. Mauvros

    Mauvros PhD in dumbfuckery Member

    Messages:
    662
    Likes:
    374
    Local Time:
    9:40 AM
    Boon:
  23. Matheos
  24. The layout is UGLY AS F**K, but it works, and someone can easily restyle it if they want :) Any other options I should add? Let me know.

    Full Working (I think) Imager
     
  25. HymenBurster

    HymenBurster Registered User Member

    Messages:
    6
    Likes:
    3
    Local Time:
    7:40 AM
    Boon:
  26. HymenBurster
  27. Honestly, there's a hell of a lot of useless coding here.

    While all input doesn't need sanitising as such as it's not being put into a database, it does need encoding because you're manipulating the inputs to be fed into a URL, so I array_mapped all the $_GET variables in a urlencode.

    So here's a revised version, with only a fraction of the code you had.

    PHP:
    <?php
    array_map
    ('urlencode'$_GET);

    $user           $_GET['user'];
    $action         $_GET["action"];
    $gesture        $_GET["gesture"];
    $head_direction $_GET["head_direction"];
    $body_direction $_GET["direction"];
    $size           $_GET["size"];

    system("/usr/bin/curl -s --ciphers ecdhe_ecdsa_aes_128_sha https://game.boon.pw/habbo-imaging/avatarimage_figure.php?username=" .$user);

    $url_string "&action={$action}&gesture={$gesture}&direction={$direction}&head_direction={$head_direction}&size={$size}";

    echo 
    "<img src=\"https://www.habbo.com.br/habbo-imaging/avatarimage?hb=img&figure={$url_string}\" />";
    Or even this would suffice,

    PHP:
    <?php
    array_map
    ('urlencode'$_GET);

    $user       $_GET['user'];
    $url_string '';

    $params = ['action''gesture''head_direction''direction''size'];

    foreach (
    $params as $param)
        
    $url_string .= "&" $param "=" $_GET[$param];

    ltrim('&'$url_string);

    system("/usr/bin/curl -s --ciphers ecdhe_ecdsa_aes_128_sha https://game.boon.pw/habbo-imaging/avatarimage_figure.php?username=" .$user);

    echo 
    "<img src=\"https://www.habbo.com.br/habbo-imaging/avatarimage?hb=img&figure={$url_string}\" />";
     
    Last edited: Apr 25, 2016
    Mauvros likes this.
  28. Aubrey

    Aubrey I ❤️ Dogs|Princess Kawaii Member

    Messages:
    176
    Likes:
    90
    Local Time:
    11:40 PM
    Boon:
  29. Aubs
  30. Thats cool