Re: timestamp

From: Date: Fri, 22 Aug 2003 07:37:30 +0000
Subject: Re: timestamp
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160404@lists.php.net to get a copy of this message
This is what I'm using so far. But I need to put in a time stamp to calculate if the visitor is new. I want to use the IP so if the ip saved in MySQL is older than 60 minutes, it will write a new record, if not, don't: $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $getaddr = $_SERVER['REMOTE_ADDR']; $gethost = gethostbyaddr($_SERVER['REMOTE_ADDR']); $EntryDate = date("Y-m-d"); $sql = "INSERT INTO $table (IPAddress,RemoteHost,EntryDate) values('$getaddr','$gethost','$EntryDate')"; mysql_query($sql); $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $result = mysql_query("SELECT * FROM $table", $myconnection); $num_rows = mysql_num_rows($result); echo "document.write(\"$num_rows visitors. \");";

« previous php.general (#160404) next »