-
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_string( strip_tags( $_GET["action"] ) );
$direction = mysql_real_escape_string( strip_tags( $_GET["direction"] ) );
$head_direction = mysql_real_escape_string( strip_tags( $_GET["head_direction"] ) );
$gesture = mysql_real_escape_string( strip_tags( $_GET["gesture"] ) );
$size = mysql_real_escape_string( strip_tags( $_GET["size"] ) );
$u = mysql_real_escape_string( strip_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:
http://s10.postimage.org/sg6klsfeh/mhlo.png
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.
-
Re: Avatarimage.php script
SELECT look FROM users WHERE username = '$u' LIMIT 1 *
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Mathis Hbx
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.
-
Re: Avatarimage.php script
-
Re: Avatarimage.php script
Quote:
Originally Posted by
FullmetalPride
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 :)
-
Re: Avatarimage.php script
Why a while loop for a single result?
-
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));?>
-
Re: Avatarimage.php script
Quote:
Originally Posted by
joopie
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
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
dafaq?
he means you should use mysql_result instead of a loop (while)
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
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
-
Re: Avatarimage.php script
This is not an avatar image generator. This just copies the exact same avatar from Habbo...
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Funixeh
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.
-
Re: Avatarimage.php script
I have one that caches the avatars
-
Re: Avatarimage.php script
Quote:
Originally Posted by
JohnHearfield
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.
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
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...
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
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.
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Near
Not sure if ignorant or just real stupid... No point in caching? My CMS must suck now...
You are right Sir, I am stupid.
-
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.
-
Re: Avatarimage.php script
PHP Code:
foreach ($_GET as $key => $value)
{
$_GET[$key] = mysql_real_escape_string($value);
}
-
Re: Avatarimage.php script
Haha, nice script. Thankz nigga!
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Nathandj
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)
-
Re: Avatarimage.php script
Quote:
Originally Posted by
joopie
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
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
Try and remove the while loop and see what's happening
Not remove it, replace it with a mysql_result /facepalm
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
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
-
Re: Avatarimage.php script
Quote:
Originally Posted by
joopie
: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);
-
Re: Avatarimage.php script
Quote:
Originally Posted by
joopie
:stupid:
PHP Code:
while($row = mysql_fetch_assoc($result))
To
PHP Code:
$row = mysql_fetch_assoc($result)
/facepalm
I acctly tried that one, didn't work for me >.<
Edit: Parse error: syntax error, unexpected T_ECHO in avatarimage.php on line 20
-
Re: Avatarimage.php script
Good job guy, but this script does not support the use HTML tags <img>, try the php document be interpreted as an image like mine: http://www.maniahotel.com.br/avatar?...ure=sml&size=b
-
Re: Avatarimage.php script
Good job guy, but this script does not support the use HTML tags <img>, try the php document be interpreted as an image like mine:
http://www.maniahotel.com.br/avatar?...ure=sml&size=b
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
I acctly tried that one, didn't work for me >.<
Edit: Parse error: syntax error, unexpected T_ECHO in avatarimage.php on line 20
did you ever put an ; after the "$row = ...."???
-
Re: Avatarimage.php script
If it matter, yes, i did.
Quote:
Originally Posted by
MrCR
Something like this?:
PHP Code:
<?php
header("Content-Type: image/png");
?>
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$db = 'uber';
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($db);
$action = mysql_real_escape_string( strip_tags( $_GET["action"] ) );
$direction = mysql_real_escape_string( strip_tags( $_GET["direction"] ) );
$head_direction = mysql_real_escape_string( strip_tags( $_GET["head_direction"] ) );
$gesture = mysql_real_escape_string( strip_tags( $_GET["gesture"] ) );
$size = mysql_real_escape_string( strip_tags( $_GET["size"] ) );
$u = mysql_real_escape_string( strip_tags( $_GET["user"] ) );
$userq = mysql_query("SELECT * FROM users WHERE username = '$u' LIMIT 1");
$user = mysql_fetch_array($userq);
$looks = $user['look'];
$image = imagecreatefrompng("stand.png");
$look = imagecreatefrompng("http://habbo.com/habbo-imaging/avatarimage?figure='.$looks.'&action=" . $action . "&direction=" . $direction . "&head_direction=" . $h_direction . "&gesture=" . $gesture . "&size=" . $size . "");
imagecopy($image, $look, 9, 10, 6, 13, 49, 94);
ImagePng ($look);
imagedestroy($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']."'>";
// }
// }
?>
-
Re: Avatarimage.php script
It would be nicer if you use'd the look code instead of the username.
something like: this
-
Re: Avatarimage.php script
Quote:
Originally Posted by
iOmvuZ
It would be nicer if you use'd the look code instead of the username.
something like:
this
The point is like using for fansites and habbo-generator's. Habbo retro fansites can use that for usersystem's and other stuff :) It's really usable for other stuff to.
Example:
If the user change their look, it will be updating auto!
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
The point is like using for fansites and habbo-generator's. Habbo retro fansites can use that for usersystem's and other stuff :) It's really usable for other stuff to.
Example:
If the user change their look, it will be updating auto!
Never thought about that! OT: Thanks for the release.
-
Re: Avatarimage.php script
Quote:
Originally Posted by
Akimbo
If it matter, yes, i did.
Something like this?:
PHP Code:
<?php
header("Content-Type: image/png");
?>
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$db = 'uber';
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($db);
$action = mysql_real_escape_string( strip_tags( $_GET["action"] ) );
$direction = mysql_real_escape_string( strip_tags( $_GET["direction"] ) );
$head_direction = mysql_real_escape_string( strip_tags( $_GET["head_direction"] ) );
$gesture = mysql_real_escape_string( strip_tags( $_GET["gesture"] ) );
$size = mysql_real_escape_string( strip_tags( $_GET["size"] ) );
$u = mysql_real_escape_string( strip_tags( $_GET["user"] ) );
$userq = mysql_query("SELECT * FROM users WHERE username = '$u' LIMIT 1");
$user = mysql_fetch_array($userq);
$looks = $user['look'];
$image = imagecreatefrompng("stand.png");
$look = imagecreatefrompng("http://habbo.com/habbo-imaging/avatarimage?figure='.$looks.'&action=" . $action . "&direction=" . $direction . "&head_direction=" . $h_direction . "&gesture=" . $gesture . "&size=" . $size . "");
imagecopy($image, $look, 9, 10, 6, 13, 49, 94);
ImagePng ($look);
imagedestroy($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']."'>";
// }
// }
?>
Exactly, just make sure that the image is not when used with white background in HTML.
Man, good job, I think you and I were the only ones thinking about avatarimage for fansite use!
-
Re: Avatarimage.php script
Here's mine. Works with username or if you just want a look!
Code:
<?php
if(isset($_GET['user'])) {
$host = "host";
$username = "root";
$password = "pass";
$dbname = "db";
$connect = mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db($dbname, $connect) or die("Could not connect to database, error: ".mysql_error());
$user = mysql_real_escape_string($_GET['user']);
$figure = "figure=".mysql_result(mysql_query("SELECT look FROM users WHERE username='".$user."' LIMIT 1"),0);
header('Content-Type: image/png');
exit(file_get_contents('http://habbo.com/habbo-imaging/avatarimage?'.$figure.http_build_query($_GET)));
}
else {
$url = 'http://habbo.com/habbo-imaging/avatarimage?figure='.http_build_query($_GET);
header('Content-Type: image/png');
exit(file_get_contents($url));
}
?>
http://habbo.ac/imager.php?user=Daniel
-
Re: Avatarimage.php script
Quote:
Originally Posted by
MrCR
Exactly, just make sure that the image is not when used with white background in HTML.
Man, good job, I think you and I were the only ones thinking about avatarimage for fansite use!
That was bad ;( I fixed a new one! Yeh, fansites are good to have, and it's cool to use for Habbo Imagers, Battle ball generators etc.. :)
Quote:
Originally Posted by
iRaged
Here's mine. Works with username or if you just want a look!
Code:
<?php
if(isset($_GET['user'])) {
$host = "host";
$username = "root";
$password = "pass";
$dbname = "db";
$connect = mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db($dbname, $connect) or die("Could not connect to database, error: ".mysql_error());
$user = mysql_real_escape_string($_GET['user']);
$figure = "figure=".mysql_result(mysql_query("SELECT look FROM users WHERE username='".$user."' LIMIT 1"),0);
header('Content-Type: image/png');
exit(file_get_contents('http://habbo.com/habbo-imaging/avatarimage?'.$figure.http_build_query($_GET)));
}
else {
$url = 'http://habbo.com/habbo-imaging/avatarimage?figure='.http_build_query($_GET);
header('Content-Type: image/png');
exit(file_get_contents($url));
}
?>
http://habbo.ac/imager.php?user=Daniel
Thay was good bro :)