Advertisement
Guest User

Untitled

a guest
Sep 26th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. <?php
  2. if (basename($_SERVER["PHP_SELF"]) == "vote.php") {
  3. die("403 - Access Forbidden");
  4. }
  5. ?>
  6. <div class="panel-heading crimson"><span class="glyphicon glyphicon-thumbs-up"></span> &nbsp Vote</div>
  7. <div class="panel-body">
  8. <?php
  9. if (!isset($_SESSION['id'])) {
  10. ?>
  11. <p>Please log in to vote.</a> </p>
  12. <?php
  13. } else {
  14. echo '<div class="alert alert-info" role="alert"><div class="text-center">Current voting rewards<br>NX: ' . $gnx . '<br>Vote Points: ' . $gvp . '</div></div>';
  15. error_reporting(1);
  16. $earnedpoints = false;
  17. $insertnew = false;
  18. $time = $mysqli->real_escape_string(time());
  19. $account = $_SESSION['name'];
  20. $ipaddress = $_SERVER['REMOTE_ADDR'];
  21. $result = $mysqli->query("SELECT * FROM voterecord WHERE NOT accountid='' AND NOT accountid='0' AND accountid='" . $account . "' OR ip='" . $ipaddress . "' ORDER BY votetime DESC") or die('Error - Could not look up vote record!');
  22. $row = $result->fetch_assoc();
  23. $timecalc = $time - $row['votetime'];
  24. if ($row['votetime'] == 0) {
  25. $timecalc = 0;
  26. }
  27. $timeinsec = $row['votetime'] / 1000;
  28. if (!isset($_POST['submit'])) {
  29. if ($timecalc < $vtime) {
  30. $voted = false;
  31. echo '<p>Your last vote was on: ' . date("d-m-Y", $timecalc) . '</p><form action="?p=vote" method="post"> <input type="submit" name="submit" value="VOTE FOR COMMERCI ON GTOP100" class="btn btn-danger btn-block"/></form>';
  32. } else {
  33. $voted = true;
  34. echo '<p>Your last vote was on: ' . date("d-m-Y", $timecalc) . '</p><a href="#" class="disabled btn btn-danger btn-block">You cannot vote yet.</a>';
  35. }
  36. } else {
  37. if (!$voted) {
  38. $result = $mysqli->query("SELECT * FROM voterecord WHERE NOT accountid='' AND NOT accountid='0' AND accountid='" . $account . "' OR ip='" . $ipaddress . "' ORDER BY votetime DESC") or die('Error - Could not look up vote record!');
  39. $row = $result->fetch_assoc();
  40. $timecalc = $time - $row['votetime'];
  41. if ($row['votetime'] == 0) {
  42. $timecalc = 0;
  43. }
  44. if ($timecalc < $vtime) {
  45. $result = $mysqli->query("INSERT INTO voterecord (ip, accountid, redeemed) VALUES ('" . $ipaddress . "', '" . $account . "', '0')") or die('Error - Could not update vote records!');
  46. $earnedpoints = true;
  47. if ($earnedpoints == true) {
  48. $funct_msg = '<meta http-equiv="refresh" content="0; url=' . $votelink . '">';
  49. $redirect = true;
  50. }
  51. if ($redirect == true) {
  52. echo $funct_msg;
  53. }
  54. }
  55. }
  56. }
  57. ?>
  58.  
  59. <?php
  60. }
  61. ?>
  62.  
  63. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement