I am trying to create a web survey questionaire, but I don’t want same people using same ip to submit it more than once within an hour time, I am using php, I assume I need to use
$_SERVER['REMOTE_ADDR'] to get the client ip and store in the session or database and then use it to compare the new ip, I am not sure if it is right and don’t know how to exact implement this in php, can anyone help me with it, thanks in advance!
I am trying to create a web survey questionaire, but I don’t want same
Share
When survey is submitted:
However, you may find that this is not a good requirement – there are many valid situations where multiple users may use the same IP address (such as, for example, student accomodation). You may be preventing valid submissions by imposing this limit.
EDIT
Here is a basic outline of how you might do this with cookies (taking into account the limitations discussed below).
Our cookie system works on a pair of values.
ckv_1will hold the timestamp at which the last survey was submitted.ckv_2will hold a hash based on the timestamp and a salt, in an effort to stop people from screwing with the cookies. Obviously, if both cookies are deleted, we won’t be able to detect it, but at least this provides some sort of validation: