iGuest 3 Report post Posted September 26, 2007 Hi I've recently made some changes to my site's design, and uploaded them to a seperate directory to work on. These changes include modifying a status signature, which is just a little image that displays your Habbo Hotel Figure, mission, etc. I uploaded the design to http://forums.xisto.com/no_longer_exists/, and this works fine. However, when I try to access http://forums.xisto.com/no_longer_exists/, where the status signature is, it just keeps loading, but never loads, or stops, or comes up with an error! It doesn't appear to be a problem with my script, as I had accidentally used an old password to connect to the database, which would have caused an error. If you want to see it for yourself, go to http://forums.xisto.com/no_longer_exists/profiles?name=7249 Here's my script (at http://forums.xisto.com/no_longer_exists/), but like I say, I don't think the problem's got anything to do with it. <?phpheader("(anti-spam-(anti-spam-(anti-spam-content-type:))) Image/PNG");include("dbconnect.php");include("habboclass.php");$gethabboname = "select * from users where username = '".$_GET["name"]."';";$ghnresult = mysql_query($gethabboname);$ghnarray = mysql_fetch_array($ghnresult);$habboclass = new habboClass($ghnarray["habboname"], $ghnarray["hotel"]);$image = imagecreatefromgif("profile_template.gif");if ($ghnarray["hotel"]=="com.au"){ $country = "Australia"; $flag = imagecreatefromgif("flag_au.gif");}else if ($ghnarray["hotel"]=="co.uk"){ $country = "United Kingdom"; $flag = imagecreatefromgif("flag_uk.gif");}else if ($ghnarray["hotel"]=="com"){ $country = "USA"; $flag = imagecreatefromgif("flag_us.gif");}else if ($ghnarray["hotel"]=="ca"){ $country = "Canada"; $flag = imagecreatefromgif("flag_ca.gif");}else if ($ghnarray["hotel"]=="com.sg"){ $country = "Singapore"; $flag = imagecreatefromgif("flag_sg.gif");}else if ($ghnarray["hotel"]=="de"){ $country = "Germany"; $flag = imagecreatefromgif("flag_de.gif");}else if ($ghnarray["hotel"]=="fi"){ $country = "Finland"; $flag = imagecreatefromgif("flag_fi.gif");}$motto = $habboclass->motto;$rhotel = $ghnarray["hotel"];while (eregi('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.19/images/fonts/volter/', $motto)){ $motarray = explode('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.19/images/fonts/volter/', $motto); $motarray = explode('.gif" class="vchar" />', $motarray[1]); $char = $motarray[0]; $motto = str_replace('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.19/images/fonts/volter/'.$char.'.gif" class="vchar" />', Chr($char), $habboclass->motto);}while (eregi('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.18/images/fonts/volter/', $motto)){ $motarray = explode('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.18/images/fonts/volter/', $motto); $motarray = explode('.gif" class="vchar" />', $motarray[1]); $char = $motarray[0]; $motto = str_replace('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.18/images/fonts/volter/'.$char.'.gif" class="vchar" />', Chr($char), $habboclass->motto);}while (eregi('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.22/images/fonts/volter/', $motto)){ $motarray = explode('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.22/images/fonts/volter/', $motto); $motarray = explode('.gif" class="vchar" />', $motarray[1]); $char = $motarray[0]; $motto = str_replace('<img src="http://images.habbohotel.'.$rhotel.'/web/web-5.0.22/images/fonts/volter/'.$char.'.gif" class="vchar" />', Chr($char), $habboclass->motto);}$habbopicpre = imagecreatefromgif($habboclass->figure);if ($habboclass->badge){ $badgepre = imagecreatefromgif($habboclass->badge);}ImagePNG($habbopicpre, $ghnarray["username"].".png");if ($habboclass->badge){ ImagePNG($badgepre, "badges/".$ghnarray["username"].".png");}$habbopic = imagecreatefrompng($ghnarray["username"].".png");if ($habboclass->badge){ $badge = imagecreatefrompng("badges/".$ghnarray["username"].".png");}$black = ImageColorAllocate($image, 0, 0, 0);$font = "Volter (Goldfish).ttf";ImageTTFText($image, 7, 0, 21, 24, $black, $font, $ghnarray["habboname"]);ImageTTFText($image, 7, 0, 145, 116, $black, $font, "Created on: ".$habboclass->birthdate);ImageTTFText($image, 7, 0, 94, 142, $black, $font, $motto);ImageTTFText($image, 7, 0, 184, 80, $black, $font, $country);ImageCopy($image, $habbopic, 13, 31, 0, 0, 64, 110);if ($habboclass->badge){ ImageCopy($image, $badge, 92, 43, 0, 0, 37, 36);}if ($habboclass->online==true){ $online = imagecreatefromgif("online.gif"); ImageCopy($image, $online, 94, 92, 0, 0, 35, 29);}else if ($habboclass->online==false){ $offline = imagecreatefromgif("offline.gif"); ImageCopy($image, $offline, 94, 92, 0, 0, 35, 29);}ImageCopy($image, $flag, 220, 14, 0, 0, 51, 69);ImagePNG($image);?> (the files are all there, by the way) Share this post Link to post Share on other sites
vujsa 0 Report post Posted September 26, 2007 Well, there is no way to determine what you problem is with the data provided.To begin with, your explanation of the problem was difficult to understand and the code you posted is a mess and incomplete. Did you ever consider that the problem may be in one of the included files? It seems that you have some type of infinite loop problem. To be honest, I'm having a really hard time just following the code you posted. For example, you could eliminate a lot of lines of code by using a switch instead of all of the if else statements. You have 3 while statements that are nearly identical and the only differences are easy to predict, you should try and combine them.It seems that you have made your code much more complicated than it needs to be but with out the code from the included files, I can't really see what is going on. I understand that you have a lot of matching and replacing going on but I can't really envision why so personally, I can't debug the script. Kind of a down fall for me, if I don't completely understand the entire script, I can't really fix any problems.You might want to better utilized tabs and comments as they will provide insight as to what you planed for that bit of code to do.One big thing I see, if you don't provide some kind of data to the script like "name" the script isn't designed to do anything. I mean, the script is meant to build an image based on the name provided so, when you try to access index.php, you are searching for nothing in the database and as a result, the server never finds a match.So, the first thing you need is to check that $_GET['name'] has a value associated to it.Next, you need to check to see if that name exists in the database.If no name is provided or the name isn't in the database, you either need a default image to show or an error message.One other thing, try to limit your use of double quotes. Double and single quotes do different things and if not needed, double quotes slow your script unnecessarily.Also, a variable can be placed in a double quoted string without the need to use concatenation character. Like so: $noun = 'kid';$my_var = "This is a happy $noun!"; You should read this:http://forums.xisto.com/topic/83220-topic/?findpost=1064298755Hope this helps, vujsa Share this post Link to post Share on other sites
iGuest 3 Report post Posted September 27, 2007 (edited) I also thought that it was an infinite loop of some kind. The while statements are slightly different (web-5.0.22, web-5.0.19 or web-5.0.18, because some hotels are on different versions, they have different paths to the Volter font characters)$_GET["name"] definitely has a value, and the name is definitely in the database.With the code, I used to always use double quotes around everything, and I still do, except for around html, and I've always ended a string before placing a variable in. It's just a habit I've got into.I'm at school right now, but when I get home, I'll post the included files.Update:dbconnect.php file: <?phpmysql_connect("localhost","<username>","<password>");mysql_select_db("habbleau_msystem");?> habboclass.php file:<?phpclass habboClass{ var $data; var $habboname; var $hotel; var $online; var $private; var $banned; var $actual; var $motto; var $badge; var $figure; var $birthdate; var $normal; var $name; function habboClass($habboname, $hotel) { $this->habboname = $habboname; $this->hotel = $hotel; $this->data = file_get_contents("http://habbo." . $hotel . "/home/" . $habboname); if (eregi("This page is not available anymore", $this->data)){ $this->banned = true; }else{ $this->banned = false; } if (eregi("habbo_online_anim.gif", $this->data)){ $this->online = true; }else{ $this->online = false; } if (eregi('<div id="page-headline-text">Habbo Homes</div>', $this->data)){ $this->actual = true; }else{ $this->actual = false; } if (eregi('marked this page as private.', $this->data)){ $this->private = true; }else{ $this->private = false; } $motto = explode('<div class="profile-motto">', $this->data); $motto = explode('<div class="clear"></div>', $motto[1]); $motto = trim($motto[0]); $this->motto = str_replace(' <div class="clear">', '', $motto); if (eregi("c_images/album1584/", $this->data)){ $badge = explode('http://images.habbohotel.' . $this->hotel . '/c_images/album1584/', $this->data); $badge = explode('.gif', $badge[1]); $badge = trim($badge[0]); $this->badge = "http://images.habbohotel." . $this->hotel . "/c_images/album1584/" . $badge . ".gif"; }else{ $this->badge = false; } $this->figure = "http://campaigns.habbo.com/0702/app/habboimage.php?habboname=".$this->habboname."&site=http://forums.xisto.com/no_longer_exists/; $birthdate = explode('<div class="birthday date">', $this->data); $birthdate = explode('</div>', $birthdate[1]); $this->birthdate = trim($birthdate[0]); if (!$this->banned and !$this->private and $this->actual){ $this->normal = true; }else{ $this->normal = false; } $name = explode('<span class="name-text">', $this->data); $name = explode('</span>', $name[1]); $name = trim($name[0]); $this->name = $name; }}?> I didn't actually make habboclass.php, it's a script that I downloaded from http://forums.xisto.com/no_longer_exists/.Hang on.It's working now. That's weird.... Maybe it was just one of those things? It's odd, because I didn't edit anything. Edited September 27, 2007 by Habble (see edit history) Share this post Link to post Share on other sites
Sten 0 Report post Posted September 27, 2007 your status signature (what this is all for) still has bugs. it isnt showing the right group badge, ive got my badge set at favourite but it shows another groups badge that im in. so thats something you might wanna fix. although thats your first time with the group badge thing so yeah i spose its ok, i couldnt do anything like that. Share this post Link to post Share on other sites