Something to uniquely identify a user on a computer using PHP
I'm making a site and there is no registrations. I can use IPs to identify people but that's not always开发者_运维百科 safe or accurate. Is there a way I can make it so I can identify uniquely who can edit/delete the post they posted?
Also.. a note. People can post messages but can only edit or delete within the first 5 minutes so it's not like I'm checking forever. I'm only checking for 5 minutes and then they can't do anything. Also the IP, I guess, is bad for people who do it in like a workplace or school.
Since it's only for a few minutes a cookie with a unique session id in it would probably do the trick. There could be edge cases where a user has cookies disabled, but it should be fine the vast majority of the time.
Even though there's no registrations, you can still drop a cookie.
Generate a UUID, put it in a cookie, and use that.
精彩评论