Game-Jaming/Backend/Controllers/Polls/Vote.php

29 lines
534 B
PHP
Raw Normal View History

2021-03-12 13:05:31 +00:00
<?php
2021-03-16 11:46:44 +00:00
require_once "../../../bootstrap.php";
2021-03-12 13:05:31 +00:00
use \Backend\Models\Group;
/**
* @param string $voteId
* @return bool
*/
function VoteCheck(string $voteId): bool
{
$votes = array();
if(isset($_COOKIE["VotingReg"])) {
$votes = unserialize($_COOKIE["VotingReg"]);
foreach ($votes as $vote){
if($voteId === $vote) {
return false;
}
}
}
array_push($votes,$voteId);
setcookie("VotingReg", serialize($votes), time() + 86400, "/");
return true;
}