Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.63 KB | None | 0 0
  1. <div id="main">
  2. <div class="sidebartop">Vote</div>
  3. <div class="sidebarbox">
  4.  
  5. <!-- VOTE -->
  6. <?php
  7. function getVoteErr($err) {
  8. if($err == "1") {
  9. echo '<p class="error">Please fill in the correct account credentials.</p>';
  10. } elseif($err == "2") {
  11. echo '<p class="error">You must be logged out to vote for rewards.</p>';
  12. } elseif($err == "3") {
  13. echo '<p class="error">You\'ve already voted with this account in the past 12 hours!<br />Last time you voted was on: '.$_SESSION['vote_date'].'!</p>';
  14. }
  15. }
  16. if(isset($_POST['doVote'])) {
  17. $earnednx = false;
  18. $account = $_POST['name'];
  19. $account = mysql_real_escape_string($account);
  20. mysql_select_db($host['database']);
  21. $query=mysql_query("SELECT * FROM accounts WHERE name='" . mysql_real_escape_string($_POST["name"]) . "'");
  22. $info=mysql_fetch_assoc($query);
  23. if($_POST["name"] == "") {
  24. $_SESSION['vote_err'] = "1";
  25. echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
  26. } elseif($_POST["password"] == "") {
  27. $_SESSION['vote_err'] = "1";
  28. echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
  29. } elseif(mysql_num_rows($query) < 1) {
  30. $_SESSION['vote_err'] = "1";
  31. echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
  32. } elseif(($info["password"] != hash('sha512',$_POST["password"].$info["salt"]) && sha1($_POST["password"])) && $info["password"] != sha1($_POST["password"])) {
  33. $_SESSION['vote_err'] = "1";
  34. echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
  35. } elseif($info["loggedin"] > 0) {
  36. $_SESSION['vote_err'] = "2";
  37. echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
  38. } else {
  39. $ip = $_SERVER['REMOTE_ADDR'];
  40. $time = time();
  41. $get = "SELECT *, SUM(`times`) as amount FROM voterecords GROUP BY account='$account'";
  42. $query1 = mysql_query($get);
  43. $lasttime = mysql_fetch_array($query1);
  44. $amount = $lasttime['amount'];
  45. $insertnew = false;
  46. if ($amount == "") {
  47. $insertnew = true;
  48. }
  49. $timecalc = $time - $lasttime['date'];
  50. if (!$insertnew) {
  51. if ($timecalc < 43200) { // 43200 ms is 12 hours
  52. date_default_timezone_set(''.$timezone.'');
  53. $_SESSION['vote_err'] = "3";
  54. $_SESSION['vote_date'] = date('M d\, h:i:s A', $lasttime['date']);
  55. echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
  56. } else {
  57. $update = mysql_query("SELECT * from voterecords WHERE ip='$ip' AND account = '$account'");
  58. if ($update) {
  59. mysql_query("UPDATE voterecords SET account='$account', date='$time', times=times+1 WHERE account='$account'");
  60. mysql_query("UPDATE voterecords SET account='$account', date='$time', times=times+1 WHERE ip='$ip'");
  61. $earnednx = true;
  62. } elseif (!$update) {
  63. $ipinsert = mysql_query("INSERT INTO voterecords (`account`, `ip`, `date`, `times`) VALUES ('$account', '$ip', '$time', 1)");
  64. if (!$ipinsert) {
  65. $message = 'Invalid query: ' . mysql_error() . "\n";
  66. $message .= 'Whole query: ' . $ipinsert;
  67. die($message);
  68. } else {
  69. $earnednx = true;
  70. }
  71. } else {
  72. $message = 'Invalid query: ' . mysql_error() . "\n";
  73. $message .= 'Whole query: ' . $update;
  74. die($message);
  75. }
  76. }
  77. } else {
  78. $success = mysql_query("INSERT INTO voterecords (`account`, `ip`, `date`, `times`) VALUES ('$account', '$ip', '$time', 1)");
  79. if (!$success) {
  80. $message = 'Invalid query: ' . mysql_error() . "\n";
  81. $message .= 'Whole query: ' . $success;
  82. die($message);
  83. } else {
  84. $earnednx = true;
  85. }
  86. }
  87. // Insert the NX into the db now
  88. if ($earnednx) {
  89. mysql_query("UPDATE accounts SET votePoints = votePoints + '1' WHERE name='" . mysql_real_escape_string($_POST["name"]) . "'");
  90. mysql_query("UPDATE accounts SET maplePoint = maplePoint + '5000' WHERE name='" .mysql_real_escape_string($_POST["name"]) . "'");
  91. mysql_query("UPDATE accounts SET lastvote='" .time(). "' WHERE name='" . mysql_real_escape_string($_POST["name"]) . "'");
  92. mysql_close();
  93. echo '<html>';
  94. echo '<head>';
  95. unset($_SESSION['vote_err']);
  96. echo '<meta HTTP-EQUIV="REFRESH" content="0; url='.$votelink.'">';
  97. echo '</head>';
  98. echo '</html>';
  99. }
  100. }
  101. }
  102. ?><!-- END VOTE PHP SCRIPT -->
  103.  
  104. <!-- BEGIN VOTE -->
  105. <div align="center">
  106. <div id="message-yellow">Not interested in any rewards, but still wanna vote? <a href="<?php echo $votelink; ?>" target="_blank">Click Here</a></div>
  107. <br />
  108. <div id="vote">
  109. <fieldset class="normal">
  110. <legend>Vote</legend>
  111. <b>Welcome to the Vote Page!</b><br />
  112. You can vote for us every 12 hours, and get rewards for voting.<br /><br />
  113. <b>Attention: Once transferred to vote page, please type the word you read in the captcha image and click "Submit".</b><br /><br />
  114. Also, once you click submit, your Account and IP Address will be logged.<br />Please don't try to fool us with fake votes, bypasses, ect.<br>You may get suspended/banned.<br /><br />
  115. <b>Below, please fill in your login credentials.</b><br />Click submit once filled out to get confirmed.<br />
  116. 5k NX and 1 Vote Point will be added to your account
  117. <form action="?page=vote" method="POST"><br>
  118. <div style="width:70px; float:left;">Username:</div><input type="text" name="name" maxlength="15" class="input" ><br />
  119. <div style="width:70px; float:left;">Password:</div><input type="password" name="password" maxlength="15" class="input" ><br />
  120.  
  121. <input type="hidden" name="submit_check" value="1">
  122. <input type="submit" name="doVote" value="Submit" class="doVote"><br />
  123. <?php getVoteErr($_SESSION['vote_err']); ?>
  124. </form>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement