|
Posted by tedpottel@gmail.com on 08/27/07 18:31
Hi
I'm trying to build a counter that will keep trach how many hits I got
and where they came from. In my html pages I have a script of code
that loads in an image. This image is a php file. When this file
executes it adds one to the stack counter,
The problem is that for the referring server, I alawyas get the server
that is hosting the web page that is calling my web page counter. I'm
assuming its because this is the server that calls the php code on my
server.
I have seen other companies do this, how do they do it????
This is what I have so far.
On the client I insert the following code onto my web pages
<img src="http://216.120.252.101/~multist/ws/add.php?
customer=fred&phrase=google&server=tedserve&filename=fred.html"
alt="boston kitchen design" width="267" height="90">
Where
http://216.120.252.101/~multist/ws/add.php is my php script to update
the stat counter
On my stat counter server,
$from=$_SERVER['HTTP_REFERER'];
// $from='ted';
$sql_string="INSERT INTO `tedpott_webstat`.`web_stat` (";
$sql_string=
$sql_string."`customer`,`path_name`,`from_server`,`key_word_phrase`,`PageID`,`server_name`,`file_name`)";
$sql_string=$sql_string." VALUES (";
$sql_string=$sql_string."'".$customer."','".$path."','".$from."','".
$phrase."','".$pg."','".$server."','".$filename."'";
$sql_string=$sql_string.")";
print("<br>");
print("<br>");
print("second string b<br>");
print($sql_string);
print("<br>");
if (!$results=mysql_query($sql_string,$dblink))
die("could not add new record");
print("updateds database ok");
// close databse connection
mysql_close($dblink);.
[Back to original message]
|