PDA

View Full Version : The image cannot be displayed, because it contains errors.



Moh
02-01-2008, 05:55 PM
Well im trying to make this script select the habbo name from a users database, and then display it from just entering the username.

I have tried it without the database and it works.

<?php
header("Content-type: image/gif");
include("config.php");
$getuser = mysql_query("SELECT * from users where username = '$_GET[user]' AND banned = '0'");
$usernum = mysql_num_rows($getuser);
$profile = mysql_fetch_array($getuser);
$habbo = '$profile[habboname]';
$domain = 'http://www.habbo.$profile[hotel]';
$content = file_get_contents($domain . '/home/'.$habbo);
$div_start = explode('<div class="profile-figure">', $content, 2);
$div_end = explode('</div>', $div_start[1], 2);
$img = trim($div_end[0]);
$img = preg_replace('/<img alt=\"(.*?)\" src=\"(.*?)\" \/>/', '$2', $img);
$imag = $domain.$img;
$im = imagecreatefromgif($imag);
imagegif($im);
imagedestroy($im);
?>

Moved by Agesilaus (Forum Moderator) from Designing & Development: Please post in the correct forum next time. :)

MrCraig
02-01-2008, 07:29 PM
um..

I wouldnt do it like that, theres a much easier way :)

Try..



<?php
header("content-type: image/gif");
require("config.php");
$get_info = mysql_fetch_array(mysql_query("SELECT * from users where username = '$_GET[user]' AND banned = '0'"));
$im_url = "http://www.habbo.";
$im_url .= $get_info[hotel];
$im_url .= "/habbo-imaging/";
$im_url .= "user=".$get_info[habbo]."&direction=4&gesture=sml&img_format=gif";
echo($im_url);
?>

Assassinator
02-01-2008, 07:35 PM
Just wondering, these scripts were they fetch a user's image and infomation etc, would there be a way to fetch a user's password?

Im not a hacker just curious lol.

Blob
02-01-2008, 07:40 PM
normally, the passwords are encrypt

MrCraig
02-01-2008, 07:40 PM
Just wondering, these scripts were they fetch a user's image and infomation etc, would there be a way to fetch a user's password?

Im not a hacker just curious lol.

Of course there is.. That wouldnt be a security risk to sulake at all....:rolleyes:

-SARCASM-

Moh
02-01-2008, 07:48 PM
I still get the error :(

http://habbcrazy.net/getuserimg/figure.php?user=jack

MrCraig
02-01-2008, 07:54 PM
Sorry, my mistake

Try


<?php
header("Content-type: image/gif");
require("config.php");
$get_info = mysql_fetch_array(mysql_query("SELECT * from users where username = '$_GET[user]' AND banned = '0'"));
$im_url = "http://www.habbo.";
$im_url .= $get_info[hotel];
$im_url .= "/habbo-imaging/avatarimage?";
$im_url .= "user=".$get_info[habbo]."&direction=4&gesture=sml&img_format=gif";
$image = imagecreatefromgif($im_url);
imagegif($image);
imagedestroy($image);
?>

Moh
02-01-2008, 08:00 PM
Same error.
I know GD works as this works:
http://habbcrazy.net/getuserimg/habbo.php?name=.:Jack120:.

Edit: Tried above one, and works now :)

Thanks. +Rep

Want to hide these adverts? Register an account for free!