Originally posted by Dj-marc
View Post
I suppose you have a table like this below
Code:
CREATE TABLE `hits_table` (
`id` int(11) AUTO_INCREMENT NOT NULL PRIMARY KEY,
`referer` int(11) NOT NULL,
`user_ip` varchar(100) NOT NULL,
`user_agent` varchar(250) NOT NULL,
`datetime` datetime NOT NULL
)
user_ip = The user who is directed's ip
user_agent = The user who is directed's browser
datetime = The datetime in which he/she directed to your site and a hit IS saved
WATCH CLOSELY now (i am about to pull a rabbit out of the hat ):
Before you save a click(hit) you MUST query to the database to check whether the user browsing has been saved as a hit. That can be achieved with an SQL stement like the one below:
SELECT * FROM hits_table WHERE referer='$referer' AND user_ip='$user_ip' AND datetime > '$datetime_in_30_minutes_back_or_less';
$datetime_in_30_minutes_back_or_less can be found by using the [datetime using the current datetime MINUS (-) 30 minutes or whatever time captcha you want to use]
dont allow a user to execute a DETELE statement (unless your not serious)
Try the suggestion and ask if your still stuck.
Leave a comment: