Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

index.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. include('inc/inc.php');
  3. if (!$user->loggedin()) {
  4. header('Location: /login.php');
  5. die();
  6. }
  7. if (!$user->voterId()) {
  8. header('Location: /login.php?denied');
  9. die();
  10. }
  11. $header = new Header("Michigan Flyers Election");
  12. $header->addStyle("/styles/style.css");
  13. $header->addScript("/js/jquery-1.11.3.min.js");
  14. $header->addScript("/js/search.js");
  15. $header->setAttribute('title', 'Michigan Flyers');
  16. $header->setAttribute('tagline', 'Online Ballot');
  17. $header->output();
  18. $candidates = $db->fetchAssoc('select skymanager_id, name, username, coalesce(email, "") as `gravatar_email` from members where voting_id is not null');
  19. $votes = $db->fetchAssoc("select position from votes where member_id={$user->voterId()}");
  20. $position = $db->fetchRow("select position as code, description as label from positions where active<>0 limit 1");
  21. get_gravatar_assoc($candidates);
  22. foreach ($votes as &$vote) {
  23. $vote = $vote['position'];
  24. }
  25. unset($vote);
  26. ?>
  27. <?php if (empty($position)): ?>
  28. <h3>There are no active votes. Reload this page once voting starts.</h3>
  29. <?php else: ?>
  30. <script type="text/javascript">
  31. var candidates = <?= json_encode($candidates); ?>;
  32. </script>
  33. <form action="vote.php" method="POST">
  34. <div class="form-row">
  35. <div class="selector">
  36. <label class="radio">
  37. <input type="radio" id="vote-<?= $position['code']; ?>" name="ballot"
  38. value="<?= $position['code']; ?>" checked />
  39. <span class="radio-button-label"><?= $position['label'] ?></span>
  40. </label>
  41. </div>
  42. </div>
  43. <div class="form-row">
  44. <input type="text" placeholder="Candidate Search" id="searchbox" name="searchbox" value="" />
  45. <div id="results"></div>
  46. <input type="hidden" name="candidate" id="candidate-input" value="0" />
  47. <div id="selectedCandidate" class="selected candidate">
  48. <span class="placeholder">No Candidate Selected</span>
  49. </div>
  50. </div>
  51. <div class="form-row">
  52. <input class="submit" type="submit" name="submit" value="Submit Ballot" />
  53. </div>
  54. </form>
  55. <?php
  56. endif;
  57. $footer = new Footer();
  58. $footer->output();