Thanks for reading my question.
I have a standard http url and DateTime formated Year-Month-Day Hour:Minute:Seconds and IPAddress stored in a table.
I don't want to insert new data into the table until at least 5 seconds have passed and the IP address has changed.
If the page or browser has a problem i don't want to keep logging entries for no reason. I'm mainly just trying to get a handle on where my users are going on the site and where bots/spiders are going / doing.
$sql = "SELECT MAX(ID) AS `LASTID`, `SiteUrl`, `DateTime` FROM `" .
DB_TABLE_SPIDER . "` WHERE
( UNIX_TIMESTAMP( NOW() ) - UNIX_TIMESTAMP(`DateTime`) > 5
AND `IP1` = '$IP1' GROUP BY `LASTID` LIMIT 1";
So I figure I need to fetch the last ID that was inserted make sure 5 seconds have passed and if the current user IP equals the stored IP in the last ID, then I think I I would get no return and know that the user / bot is already on that page?
Also I'm wondering if it's possibe with MySQL to do something like this?
INSERT INTO `" . DB_TABLE_SPIDER . "`
(tablelist bla bla) VALUES (values bla bla) IF ( ( UNIX_TIMESTAMP( NOW() ) - UNIX_TIMESTAMP(`DateTime`) > 5
AND `IP1` = '$IP1' ) GROUP BY `LASTID`";
I've seen some IF's in a SQL query before but could not figure out what was going on at the time because it didn't seem to take the same format as PHP IF's.
Anyway thanks for any help