NYCPHP Meetup

NYPHP.org

[nycphp-talk] Experts help needed (Sessions)

Chris Shiflett shiflett at php.net
Sun Aug 7 00:32:00 EDT 2005


Joseph Crawford wrote:
> so what you are suggesting is that i grab the users UA every page load,
> once i have 50 of them compare them to see how many i have that are not
> consistant?

Not at all.

1. Record the user agent. This is just a string, and you can record the 
MD5 of it to give yourself a consistent format and size (and eliminate 
some injection concerns).

2. Upon each visit, you'll have a conditional statement that compares 
the user agent in the current request with the one you recorded. If they 
are the same, increment the counter. If they are different, reset the 
counter (and perhaps record the new user agent).

3. If the counter passes a threshhold of your choosing, enforce the 
consistency check by prompting for a password when the user agents don't 
match.

Something like that - you shouldn't be recording a bunch of user agents 
and doing lots of comparisons.

Chris

-- 
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/



More information about the talk mailing list