PDA

View Full Version : Site Suspended - ways to put less strain on the server..?


Arianna
02-14-2010, 01:19 AM
My whole website (keep in mind this isn't just an adoptable website, it's a forum too) was just suspended due to 'the large amount of connections to images such as /twig/adoptables/siggy.php?id=1495'. Yeah, that's right - because of the adoptables script and people viewing images.
I was hosted with WebzPro, but now my account is suspended and I'm devastated. I have two questions for you guys - how do you cope with many people viewing the images, and is there a way to make it so this doesn't happen again? I'm thinking of changing hosts because I really can't get what was wrong - I wasn't even near my alloted bandwidth!
Arianna

BMR777
02-14-2010, 02:08 PM
It's not bandwidth that is the issue, it's the processing power required to load the images from the siggy.php file that is the issue.

Try using the following code in siggy.php instead of the current code:

<?php

// Lightweight siggy.php file for laggy server...

// Include our Includes...

include("inc/functions.php");
include("inc/config.php");

// Get the ID of the adoptable image we want to load...

$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9s]/", "", $id);
$id = secure($id);

if(is_numeric($id)){

// Run a query to make sure that the adoptable does in fact exist...

$num = 0;

$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);

if($num > 0){

// We've got a valid adoptable here, now get the image to use...

$image = getcurrentimage($id);

// Redirect to the image...

$location = "Location: ".$image;

header($location);

}
else{

die("The adoptable does not exist or is not valid.");

}



}

?>

It's a special lightweight siggy.php that I use on MyAdopts, which has thousands of requests for signature images. It also doesn't use GD image text, which can eat up processing power very quickly.

Please try this out and let me know if it works better for you. :)

Arianna
02-14-2010, 02:11 PM
Thank you very much, I will replace this now. (:

redheadturkey
02-14-2010, 03:56 PM
try powerhoster.com if you need a new hosting service, they are very good, and have fantastic plans! ^^