I have a website i'm currently desgining. I was curious as to what the best option would be to prevent users from double posting content (typing a comment and pressing submit and pressing it again etc). I am aware of requiring them to register, cookies, session variables, unique ip addresses.
My goal is to have users submit a comment and then not be able to for a period of time. I am not sure if there is a way but I would like others on the network to be able to post and I don't want the person to just refresh or close their browser to post again. So is there some way to differentiate unique users from a repeat user and time out the server for the repeat user.
Question About Website Security Using PHP
Page 1 of 14 Replies - 263 Views - Last Post: 27 May 2011 - 08:30 AM
Replies To: Question About Website Security Using PHP
#2
Re: Question About Website Security Using PHP
Posted 23 May 2011 - 09:28 PM
Hey.
If you are talking about registered users, then it's simply a matter of fetching the time of their last post.
If not, then you are kind of limited to the technologies you just mentioned. There is little you can do to track unregistered users, beyond using cookies and IP addresses. - If you allow guest comments without some sort of registration, somebody who really wants to post repeatedly will be able to. You can make it harder, but you can't reliably prevent it.
Cookies are probably your best bet. They'll persist even when a browser is closed, given that the user does not choose to block or purge them. - Restricting them based on IP addresses is always a bit dodgy, as an IP doesn't necessarily belong to a single user, and there are ways to get around such restrictions.
If you are talking about registered users, then it's simply a matter of fetching the time of their last post.
If not, then you are kind of limited to the technologies you just mentioned. There is little you can do to track unregistered users, beyond using cookies and IP addresses. - If you allow guest comments without some sort of registration, somebody who really wants to post repeatedly will be able to. You can make it harder, but you can't reliably prevent it.
Cookies are probably your best bet. They'll persist even when a browser is closed, given that the user does not choose to block or purge them. - Restricting them based on IP addresses is always a bit dodgy, as an IP doesn't necessarily belong to a single user, and there are ways to get around such restrictions.
#3
Re: Question About Website Security Using PHP
Posted 23 May 2011 - 09:29 PM
If you're using a database (which I assume is likely, seeing as how you've got a comment system going there), you could make it record a timestamp regarding the user's last comment at the time of posting. Then, whenever the user attempts to post, you'd simply check the database and see if the specified time period has passed since their last comment. If yes, allow the post. If not, block it with an error message detailing as much.
EDIT: Actually, read Atli's post, it's a bit more thorough, as he cover guest posting as well.
EDIT: Actually, read Atli's post, it's a bit more thorough, as he cover guest posting as well.
This post has been edited by Valek: 23 May 2011 - 09:29 PM
#4
Re: Question About Website Security Using PHP
Posted 24 May 2011 - 10:39 AM
Quote
My goal is to have users submit a comment and then not be able to for a period of time. I am not sure if there is a way but I would like others on the network to be able to post
A small comment on this...
Let's say we have user X and user Y and user X posts his comment but has to wait for argument's sake 10 minutes to post again on that thread. What if user Y follows up with a post about 2 minutes after user X then user X will still have to wait a whole 10 minutes to reply again.
If we had that policy on here then the Caffeine Lounge would be a pain especially when posts are made at a very high rate per minute. I better solution (in my opinion) would be to simply keep track of the last poster. If user X is the last poster then he isn't allowed to post until someone else posts. That should take care of the problem of refreshing the browser too.
#5
Re: Question About Website Security Using PHP
Posted 27 May 2011 - 08:30 AM
I actually never thought about it like that. But now that you mention it, it does seem like there would be a bigger problem. I do like your suggestion though. I think that would be easier to implement too.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|