Hey peaps. I've created a security system which logs various info about the client, eg: ip, os, hostname, browser etc. How do I stop php from logging the same info all the time? Say if I refreash the page with the script in, it keeps on logging, regards of it being the same info! how do i stop it? I only want it to log different info, ie different IPs and hostnames, broswer and os are alright.
my code:
<?php
$fp = fopen ("./file.htm", "a");
$stamp = date("H:i:s d/m/y");
$host = gethostbyaddr($REMOTE_ADDR);
$useragent = $_SERVER["HTTP_USER_AGENT"];
$line = "<p><b><font size='4'>Date & time:</b></font> $stamp ||
<font size='4'><b>IP:</b></font> $REMOTE_ADDR ||
<font size='4'><b>Host:</b></font> $host ||
<font size='4'><b>Browser & OS:</b></font> $useragent</p>\n";
if (fputs($fp, $line)) {
echo "successful write<br>\n";
} else {
echo "<font color='#FF0000'>failed!</font>";
}
?>
any suggestions? thx.