Entry
Is it possible to do a multisite hit counter that runs on a PHP enabled server but is accessed by non PHP servers?
Mar 15th, 2008 21:19
dman, ha mo, Sergio Marchesini, Dave Bett, http://www.ttnr.org
Sure, here's how I do it :
In my non-php-enabled server I use some javascript code, like the
following before the end of the document body:
<script type="text/javascript" language="JavaScript">
<!--
ref = ""+escape(document.referrer);
stringa="<img src=\"http://php_enabled_server.com/jscount.php3?
cfgSite=sitename§ion=section&REFER="+ref+"\" border=0 width=0
height=0 >";
document.write(stringa);
// -->
This javascript code inserts an image in your page (but with null width
and heigth so it will not be visible)
You can add all the information you need to take into account in the
javascript string. On my php server I have a file called jscount.php3
that increments the counter and then sends a transparent gif back to
the browser using readfile().
HTH
Sergio