Avatarimage.php script

Page 1 of 2 12 LastLast
Results 1 to 25 of 36
  1. #1
    Sorcerer Supreme Akimbo is offline
    Member +Rank
    Jul 2011 Join Date
    NorwayLocation
    305Posts

    Avatarimage.php script

    sup niggz? anyways, i got this shitty coded avatarimage.php file :)
    PHP Code:
    <?php
    header
    ("Content-Type: image/png");
    ?>
    <?php
    header
    ("Content-Type: image/GIF");
    ?>
    <?php
    $dbhost 
    'localhost'
    $dbuser 'root'
    $dbpass ''
    $db 'uber'

    mysql_connect($dbhost,$dbuser,$dbpass);   
    mysql_select_db($db);   
    $action mysql_real_escape_stringstrip_tags$_GET["action"] ) ); 
    $direction mysql_real_escape_stringstrip_tags$_GET["direction"] ) ); 
    $head_direction mysql_real_escape_stringstrip_tags$_GET["head_direction"] ) ); 
    $gesture mysql_real_escape_stringstrip_tags$_GET["gesture"] ) ); 
    $size mysql_real_escape_stringstrip_tags$_GET["size"] ) ); 
    $u mysql_real_escape_stringstrip_tags$_GET["user"] ) ); 
    $userq mysql_query("SELECT * FROM users WHERE username = '$u' LIMIT 1");
    $user mysql_fetch_array($userq);
    $looks $user['look'];
    $look imagecreatefromgif("http://habbo.com/habbo-imaging/avatarimage?figure='.$looks.'&action=" $action "&direction=" $direction "&head_direction=" $head_direction "&gesture=" $gesture "&size=" $size "&img_format=gif");


    ImageGif ($look);    


    // $result = mysql_query($query) or die('Query failed: ' . mysql_error()); //Okay
    // if(mysql_num_rows($result)) { //thihi<3
    // while($row = mysql_fetch_assoc($result)) { //resultat...
    // echo "<img src=\"http://habbo.com/habbo-imaging/avatarimage?figure=".$row['look']."\" alt='".$row['username']."'>";
    //        }
    // }
    ?>
    Coded in 20 mins, works for Rev, Uber, everything :)

    Image:

    Live Preview:
    http://74.63.245.136/avatarimage.php...ser&action=wav
    Users: hellokitty, someuser.

    UPDATE: Now with action, gesture, and other stuff!
    Not using <img src> function anymore, saving images!
    Another, now saving in GIF.

    Bye.
    Last edited by Akimbo; 16-12-12 at 09:04 PM.


  2. #2
    Member Mathis Hbx is offline
    MemberRank
    Jul 2012 Join Date
    FranceLocation
    52Posts

    Re: Avatarimage.php script

    SELECT look FROM users WHERE username = '$u' LIMIT 1 *

  3. #3
    Ask me about Daoism FullmetalPride is offline
    Grand MasterRank
    Nov 2010 Join Date
    2,172Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Mathis Hbx View Post
    SELECT look FROM users WHERE username = '$u' LIMIT 1 *
    Yeah, it's so simple, why would you make this? :l It's already coded into CMSs.

  4. #4
    Elite Member iOmvuZ is offline
    Member +Rank
    May 2012 Join Date
    104Posts

    Re: Avatarimage.php script

    EDIT: THanks!

  5. #5
    Sorcerer Supreme Akimbo is offline
    Member +Rank
    Jul 2011 Join Date
    NorwayLocation
    305Posts

    Re: Avatarimage.php script

    Quote Originally Posted by FullmetalPride View Post
    Yeah, it's so simple, why would you make this? :l It's already coded into CMSs.
    I made this bcus it's useful for retro fansites and stuff. Then they can use the script to make habbo imagers and stuff :)

  6. #6
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: Avatarimage.php script

    Why a while loop for a single result?

  7. #7
    ☮TAKU???? seanrom is offline
    Grand MasterRank
    Nov 2009 Join Date
    1,004Posts

    Re: Avatarimage.php script

    Instead of echoing a html tag you should do file_get_contents from the source and out headers image/png

    This is mine:
    PHP Code:
    <?php header('Content-Type: image/png'); define('IGNORE_EXECUTEMSG'true);
     if(isset(
    $_GET['user']) && $users->name_taken(c_filter($_GET['user']))) {  $_GET['figure'] = result("SELECT look FROM users WHERE username = '" c_filter($_GET['user']) . "'"); } else if(!isset($_GET['figure'])) $_GET['figure'] = 'default'; unset($_GET['user']);
     
    $file 'storage/avatars/' http_build_build($_GET) . '.png'; if (!file_exists($file)) {     $data $core->get_url('http://www.habbo.nl/habbo-imaging/avatarimage?'.http_build_build($_GET));     file_put_contents($file$data); }
     die((isset(
    $data))?$data:file_get_contents($file));?>
    Last edited by seanrom; 15-12-12 at 03:01 PM.

  8. #8
    Sorcerer Supreme Akimbo is offline
    Member +Rank
    Jul 2011 Join Date
    NorwayLocation
    305Posts

    Re: Avatarimage.php script

    Quote Originally Posted by joopie View Post
    Why a while loop for a single result?
    like, i dindn't check the codes or anything like that, i just made this quick and easy

    OF: 1,999 posts :D
    Last edited by Akimbo; 15-12-12 at 03:02 PM.

  9. #9
    ☮TAKU???? seanrom is offline
    Grand MasterRank
    Nov 2009 Join Date
    1,004Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Akimbo View Post
    dafaq?
    he means you should use mysql_result instead of a loop (while)

  10. #10
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Akimbo View Post
    like, i dindn't check the codes or anything like that, i just made this quick and easy

    OF: 1,999 posts :D
    2000*

    But, you code something and you know it should return one result? :P "LIMIT 1" in query

  11. #11
    Sorcerer Supreme Bui is offline
    Member +Rank
    Jan 2012 Join Date
    United KingdomLocation
    459Posts

    Re: Avatarimage.php script

    This is not an avatar image generator. This just copies the exact same avatar from Habbo...

  12. #12
    Sorcerer Supreme Akimbo is offline
    Member +Rank
    Jul 2011 Join Date
    NorwayLocation
    305Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Funixeh View Post
    This is not an avatar image generator. This just copies the exact same avatar from Habbo...

    It's a script for fansites really. And useful for other stuff to.. Never said it was a generator little boy.

  13. #13
    Eye Eye Capt'n Spheral is offline
    Grand MasterRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: Avatarimage.php script

    I have one that caches the avatars

  14. #14
    Sorcerer Supreme Akimbo is offline
    Member +Rank
    Jul 2011 Join Date
    NorwayLocation
    305Posts

    Re: Avatarimage.php script

    Quote Originally Posted by JohnHearfield View Post
    I have one that caches the avatars
    What's the poitn with that? Yeh, it does take more space! That must be the point.
    The point with this is for fansites really. It's simple and easy. Still pretty secure.

  15. #15
    Sorcerer Supreme Near is offline
    Member +Rank
    Sep 2009 Join Date
    The NetherlandsLocation
    491Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Akimbo View Post
    What's the poitn with that? Yeh, it does take more space! That must be the point.
    The point with this is for fansites really. It's simple and easy. Still pretty secure.
    Not sure if ignorant or just real stupid... No point in caching? My CMS must suck now...

  16. #16
    Ask me about Daoism FullmetalPride is offline
    Grand MasterRank
    Nov 2010 Join Date
    2,172Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Akimbo View Post
    What's the poitn with that? Yeh, it does take more space! That must be the point.
    The point with this is for fansites really. It's simple and easy. Still pretty secure.
    It does save speed, though, but in light, it doesn't seem efficient if the person has changed their avatar. Caching is worth it.

  17. #17
    Sorcerer Supreme Akimbo is offline
    Member +Rank
    Jul 2011 Join Date
    NorwayLocation
    305Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Near View Post
    Not sure if ignorant or just real stupid... No point in caching? My CMS must suck now...
    You are right Sir, I am stupid.

  18. #18
    Eye Eye Capt'n Spheral is offline
    Grand MasterRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: Avatarimage.php script

    It might take up space, but i have a fairly small hotel, so not that much avatar's are cached in the long run.

  19. #19
    Elite Member Nathandj is offline
    Member +Rank
    Jan 2012 Join Date
    The NetherlandsLocation
    194Posts

    Re: Avatarimage.php script

    PHP Code:
    foreach ($_GET as $key => $value)
    {
        
    $_GET[$key] = mysql_real_escape_string($value);


  20. #20
    Zephyr Studios PRIZM is offline
    Grand MasterRank
    Feb 2012 Join Date
    DenmarkLocation
    2,291Posts

    Re: Avatarimage.php script

    Haha, nice script. Thankz nigga!

  21. #21
    ☮TAKU???? seanrom is offline
    Grand MasterRank
    Nov 2009 Join Date
    1,004Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Nathandj View Post
    PHP Code:
    foreach ($_GET as $key => $value)
    {
        
    $_GET[$key] = mysql_real_escape_string($value);

    http_build_query does not require an loop.
    plus its only a function (less code)
    PHP Code:
    http_build_query($_GET

  22. #22
    Sorcerer Supreme Akimbo is offline
    Member +Rank
    Jul 2011 Join Date
    NorwayLocation
    305Posts

    Re: Avatarimage.php script

    Quote Originally Posted by joopie View Post
    2000*

    But, you code something and you know it should return one result? :P "LIMIT 1" in query
    Try and remove the while loop and see what's happening

  23. #23
    ☮TAKU???? seanrom is offline
    Grand MasterRank
    Nov 2009 Join Date
    1,004Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Akimbo View Post
    Try and remove the while loop and see what's happening
    Not remove it, replace it with a mysql_result /facepalm

  24. #24
    Live Ocottish Sverlord Joopie is offline
    LegendRank
    Jun 2010 Join Date
    The NetherlandsLocation
    2,773Posts

    Re: Avatarimage.php script

    Quote Originally Posted by Akimbo View Post
    Try and remove the while loop and see what's happening
    :stupid:

    PHP Code:
    while($row mysql_fetch_assoc($result)) 
    To

    PHP Code:
    $row mysql_fetch_assoc($result
    /facepalm

  25. #25
    ☮TAKU???? seanrom is offline
    Grand MasterRank
    Nov 2009 Join Date
    1,004Posts

    Re: Avatarimage.php script

    Quote Originally Posted by joopie View Post
    :stupid:

    PHP Code:
    while($row mysql_fetch_assoc($result)) 
    To

    PHP Code:
    $row mysql_fetch_assoc($result
    /facepalm
    Maybe it does not effect the performance but as the only thing he really gets from the database is the look. Wouldent it then be better with a mysql_result?

    Like this:
    PHP Code:
    $look mysql_result(mysql_query("SELECT look FROM users WHERE username = '" $u "'"), 0); 



Page 1 of 2 12 LastLast

Advertisement