Copy link to clipboard
Copied
Hi CFers,
Anyone know how I can block the user to which the same answer the survey satisfaction only one once?
IP address or COOKIE, what is the better way to do?
P.S. records in the XML file no DB.
Tks,
Fabiano Magno Pechibella
Copy link to clipboard
Copied
Use both IP address and persistent cookie.
Copy link to clipboard
Copied
Cookie is better since it is very specific to that user. IP's change all the time on some ISPs.
Copy link to clipboard
Copied
A cookie won't prevent the same user from submitting through multiple browsers from the same machine (e.g. Firefox, Chrome, IE, Safari), or even Chrome and Chrome Incognito (and the like). IP address may help that a bit, but as @tribule pointed out, IP addresses can change (especially if the person is using a laptop or mobile device and moving between WiFi networks).
Copy link to clipboard
Copied
Cookie has one other advantage over IP. It is more versatile, and more amenable to business logic. For example, it would make sense to write different cookies that tell you whether the user does vote or not.
As I said elsewhere, if the user-response is that important to you, you should implement authentication. You could then include an ID in the survey to uniquely identify respondents, and convert the XML data into a format suitable for storage in a relational database.