|
Posted by Jerry Stuckle on 08/28/07 00:30
tedpottel@gmail.com wrote:
> 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);.
>
What did you expect? It is being loaded because of an img tag in your
code, so that is the referring server. It is not the same as the
referrer (which, BTW, is COMPLETELY UNRELIABLE) for your main page.
No statistics are reliable. You have no idea if your page was cached
somewhere between the client and your server, for instance. But as
Micha indicated, your server log files will give you as good information
as anything.
And BTW - I find those "counters" on a web page to be tacky. Kinda like
a prostitute bragging about how many tricks she turned.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|