Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

John_rambo's avatar

Cookie or Session for Guests?

Hi guys,

So I'm developing a mobile browser based quiz app which will allow students to answer questions that the lecturer created. Students need to vote anonymously without creating an account to use the app. Once students have voted they will be taken to another page to view the results.

But here's the problem, how can I prevent the students from going back in their browser and voting again which can potentially mess up the results? I'm not sure which one to use, a cookie or session? or maybe some sort of hardware id?

0 likes
4 replies
eKontor 24's avatar

IP & cookie is not enough because you can delete the cookie or change the IP.

You should use additional data like useragent string or things like that.

bashy's avatar

You will never be able to stop someone voting multiple times... IP and cookie is enough to be sure normal people vote accordingly.

JarekTkaczyk's avatar

There are also Local Shared Objects aka flash cookies, that are less known and almost no one ever deletes them :)

Obviously it's more of a curiosity than real advice for you.

Please or to participate in this conversation.