Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping track of who comes to my site.

Status
Not open for further replies.

insomica

Technical User
Apr 30, 2003
9
US
Does anyone have a better script that shows me who comes to my site and where then go inside my site. other then this....

function hits ($QUERY_STRING, $REMOTE_ADDR, $HTTP_REFERER, $SCRIPT_NAME)
{
$qs = basename($QUERY_STRING); // for aim
$qs = str_replace("%20","_",$qs); // for aim

if ($qs != "mysn")
{

$page = basename($SCRIPT_NAME);

$differencetolocaltime=2;
$new_U=date("U")+$differencetolocaltime*3600;
$date = date("g:ia - F d", $new_U);

$InfoOpen = fopen("userinfo.html", 'r');
$InfoRead = fread ($InfoOpen, filesize("userinfo.html"));
fclose($InfoOpen);

$gethostbyaddr = gethostbyaddr($REMOTE_ADDR);
$InfoWrite = fopen("userinfo.html", 'w');
fwrite ($InfoWrite,&quot;<table>
<tr>
<td align=top valign=top>
<b>Date: </b>$date
<br>
<b>Query Sring: </b>$qs
<br>
<b>IP: </b> <a href=\&quot; <br>
<b>Host: </b>$gethostbyaddr
<br>
<b>Referer: </b>$HTTP_REFERER
<br>
<b>Page: </b>$page
</td>
</tr>
</table>
<br>
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
$InfoRead&quot;);
}
}
 
It seems to me that you are duplicating a lot of the logging that your web server is probably already doing.

One suggestion would be to write a PHP script that processes the web log, adding the information which the server does not log.



Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top