Forum Moderators: open
I have 2000 active counters and >300,000 "hits" per day. (Hits, as defined by my web host.) My accounts allows me up to 10 million/month and I already reached them.
There is obviously a problem with the way I wrote the script. A friend told me that my problem is that "I am executing my page at my server level (my host's) rather than at my user's level". Whatever that means.
Here is what I am doing.
The user inserts this JS on his web page:
<script language="javascript" src="http://example.com/example/counter.php?user_counter=10000_1"> </script>
counter.php calls a script that turns into JS the php script that actually builds the counter:
<?php
session_start();
$user_counter=$_GET['user_counter'];
$_SESSION['user_counter']=$user_counter;
include('makejavascript.php');
include('example.php');
?>
makejavascript.php
<?php
function ob_makejavascripthandler($output) {
return sprintf('document.write(unescape("%s"));',rawurlencode($output));
}
ob_start("ob_makejavascripthandler");
?>
My friend suggests that rather than executing the script on my server and returning the "image" of the counter to my users, I should be sending the html code of the counter. This way I do not get taxed by all the hits.
I doubt I succeeded in explaining my problem, but I sincerely hope you can help me.
Thank you.
[edited by: engine at 1:35 am (utc) on June 23, 2005]
[edit reason] TOS [/edit]
Perhpas I should be looking a how can I insert an html script into my users' page so that the script executes at his browser level and not at my server level?
Because right now I am inserting the image of the counter rather than the html script that builds it. This generates too many queries for me.
*****************************
EDIT: In my original post, by "hits" I mean queries. Sorry for my poor choice of words.
*****************************