Added footer, added radio buttons for single option polls, fixed voting bug
This commit is contained in:
@ -2,16 +2,21 @@
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
$voted_options = [];
|
||||
foreach ($_POST['options'] as $option) {
|
||||
$voted_options[] = (int)$option;
|
||||
if (is_array($_POST['options'])) {
|
||||
foreach ($_POST['options'] as $option) {
|
||||
$voted_options[] = (int)$option;
|
||||
}
|
||||
} else {
|
||||
$voted_options[] = (int)$_POST['options'];
|
||||
}
|
||||
try {
|
||||
$res = $api->voteInPoll((int)$_POST['pollid'], $voted_options, $_POST['polltoken']);
|
||||
} catch (\Exception $e) {
|
||||
get_page_header('Voting error');
|
||||
$str = 'Sorry, something went wrong while voting!'
|
||||
. 'Please yell at <a href="https://pnut.io/@hutattedonmyarm">@hutattedonmyarm></a><br>'
|
||||
. '<a href="view_poll.php?id="'.$_POST['pollid'].'>Go back to the poll</a>';
|
||||
$str = 'Sorry, something went wrong while voting! "'
|
||||
. $e->getMessage()
|
||||
. '"<br>Please yell at <a href="https://pnut.io/@hutattedonmyarm">@hutattedonmyarm</a><br>'
|
||||
. '<a href="view_poll.php?id='.$_POST['pollid'].'"s>Go back to the poll</a>';
|
||||
die($str);
|
||||
}
|
||||
redirect('view_poll.php?id='.$_POST['pollid'].'&success=1');
|
||||
|
Reference in New Issue
Block a user