You will need to store the IP address and timestamp on the server side. It is unlikely that the bot will send cookies, and even a URL-based session is not reliable.
The overhead of a file should not be too large, unless you simply register the files that kill you. You can use SQLite or similar, possibly stored in a memory-based file system for a slight increase in speed. Or you can go with something like memcached. If you need to save data, use MySQL. The overhead of a full-blown database is practically nothing compared to when PHP requires almost nothing.
If you really want to do something similar with sessions, display the user agreement page if the session does not have a specific “I Agree” variable. Thus, if the bot does not send a valid session back, all it receives is the user agreement. If so, you can track it using session variables.
Keep in mind that a session-based solution is not required, since you do not need to remember the state of the client between requests, and these sessions will carry more, if not more, overhead than most user alternatives.
Regarding the assertion that session variables can be processed using cookies, this is not entirely true. However, if you are stupid enough to leave register_globals enabled and you are requesting a global variable, I would not want to fear that this would come from a session, cookie, query string, environment, or previously undefined. This is all debatable if you explicitly access through $ _SESSION of course.
source share