PDA

View Full Version : oh dear.


rosepose
03-29-2009, 05:55 PM
My site keeps crashing due to CPU overloads. Apparently it's because there a ton of hotlinking and stuff going on, if there any way for me to minimize this?

-Rose

kisazeky
03-29-2009, 07:18 PM
Easy just put your adoptable images on a separate host like photobucket.

rosepose
03-29-2009, 07:36 PM
Yes, but that doesn't edit the existing adoptables :3

BMR777
03-29-2009, 07:42 PM
One thing I recommend you do is DISABLE the featured adoptable. The method that it uses to select the featured adoptable can use some CPU resources if your site has a lot of hosted adoptables.

In functions.php find and delete:

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);

$sql_query = "SELECT * FROM owned_adoptables ORDER BY RAND() LIMIT 1";
$result = mysql_query($sql_query);

if(mysql_num_rows($result))
{
while($row = mysql_fetch_row($result))
{
$id=@mysql_result($result,$i,"uid");
$name=@mysql_result($result,$i,"name");
$imageurl=@mysql_result($result,$i,"imageurl");
$currentlevel=@mysql_result($result,$i,"currentlevel");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$owner=@mysql_result($result,$i,"owner");

$content = "<p><img src='".$imageurl."' id='me' alt='Featured Adoptable'>
<strong><a href='show.php?id=".$id."'>".$name."</a></strong><br />
Level: ".$currentlevel."<br />
Owner: ".$owner."<br />
<a href='levelup.php?id=".$id."'>Add more HP</a></p>";


}
}
else
{
$error = "No Adoptables!";
return $error;
}


That should help save some CPU for your site. :)

rosepose
03-29-2009, 08:19 PM
Thanks, I did that :3 *pokes her server* I sent them a help message asking about it.