A
A
Anton2015-11-11 07:10:54
Kohana
Anton, 2015-11-11 07:10:54

Voting, how can I make it possible to vote once?

Hello, I found the following line in the voting module:

if (isset($exists->id) && (time() - strtotime($exists->date)) < 60 * 60 * 24) {

As I understand it, she is responsible for the voting date, it seems like a day or two passes and you can vote on a new one, how to make it possible to vote once, what numbers to write down?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EVOSandru6, 2015-11-11
@EVOSandru6

Используй $_COOKIE

D
DireX, 2015-11-11
@xDireX

in your example it is exactly 24 hours.
It depends how you want to implement it. If you look at the rough side, then just change the parameter 60 * 60 * 24 to 60 * 60 * 24 * 31, then users will not be able to vote for a month :-)
But this is bad, because the poll can change.
Use cookies as described above, but make the cookie name prefixed with the survey ID. For example vote_101, then check it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question