Hi, On my site im trying to make a skin selector. The skin chooser saves your preference in a cookie.
here is my index.php
Code:
<?
include('loadskin.php');
include(''.$path.'index.php');
?>
loadskin.php reads your cookie, and determines what skin you wanted to use. It then loads
the filepath to the template file and saves it as $path.
loadskin.php
Code:
<?php
$sskin = $_COOKIE["serialdevilskin"];
switch ($sskin){
case 1:
$path = "global/clean_devil/";
break;
case 2:
$path = "global/serialsws/";
break;
if(($sskin <> 1) && ($skin <> 2)){
$sskin = "1";
}
}
The script works perfectly, it remembers what skin you chose, and it loads it correctly.
Now, here is the problem.
When ever I enable my new template system, my server loads go over 20 all of a sudden, and it crashes my server.
I am getting extremely high traffic, 30 queries a second, 70k unique hits daily. My server is getting a lot of traffic as it is, but my site uses a very well made search engine with 5 hour caching. Server loads are under 0.5 during peak hours.
Its obvious that the skin selector is causing the loads.
Can someone please help me fix this problem. Is there a better way to write this code without causing such a high load?
Thanks,
-Remus.