You are asking why they usejavascript to store statistics, or how do they do that?
yes something like that, they include a remote JS file and inside the JS is written a image tag and this image tag source sends all information like referer, IP address to the script.
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #3 on: Jul 23, 2006, 09:19:26 pm »
They do that to prevent referer spam, as most bots will not execute javascript, or load images from the page that they are spamming.
The problem is that this technique can cause big overhead to high traffic websites....
I am not sure about that, but js is a solution for that.
Thanks I will give it a try...
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #11 on: Jul 23, 2006, 09:44:33 pm »
#offtopic:
I think in two month I'm the richest man here...
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #12 on: Jul 23, 2006, 11:20:51 pm »
I got it working:
I'm including a JS file with code inside my html file (somewhere inside the body):
Code:
var ref = document.referrer; document.write("<img src=\"/include/count_visitor_statistics/count_image.php?ref="+ref+"\" border=\"0\" />");
Inside the file "count_image.php" I have acces to these variables and I'm using this code to show a small picture (1px transp. gif)
Code:
<?php class Count_image extends Count_visitors {
function Count_image() { $this->referer = (!empty($_GET['ref'])) ? $_GET['ref'] : ""; $this->host = "www.".ltrim($_SERVER['HTTP_HOST'], "www."); $url_parts = parse_url($_SERVER['HTTP_REFERER']); $this->visited_page = $url_parts['path']; $this->db_connect(); } } $img_count = new Count_image; $img_count->delay = 1; // how often (in hours) a visitor is registered in the database (default = 1 hour) $img_count->insert_new_visit(); // That's all, the validation is with this method, too.