Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (basename($_SERVER["PHP_SELF"]) == "vote.php") {
- die("403 - Access Forbidden");
- }
- ?>
- <div class="panel-heading crimson"><span class="glyphicon glyphicon-thumbs-up"></span>   Vote</div>
- <div class="panel-body">
- <?php
- if (!isset($_SESSION['id'])) {
- ?>
- <p>Please log in to vote.</a> </p>
- <?php
- } else {
- echo '<div class="alert alert-info" role="alert"><div class="text-center">Current voting rewards<br>NX: ' . $gnx . '<br>Vote Points: ' . $gvp . '</div></div>';
- error_reporting(1);
- $earnedpoints = false;
- $insertnew = false;
- $time = $mysqli->real_escape_string(time());
- $account = $_SESSION['name'];
- $ipaddress = $_SERVER['REMOTE_ADDR'];
- $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!');
- $row = $result->fetch_assoc();
- $timecalc = $time - $row['votetime'];
- if ($row['votetime'] == 0) {
- $timecalc = 0;
- }
- $timeinsec = $row['votetime'] / 1000;
- if (!isset($_POST['submit'])) {
- if ($timecalc < $vtime) {
- $voted = false;
- 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>';
- } else {
- $voted = true;
- 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>';
- }
- } else {
- if (!$voted) {
- $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!');
- $row = $result->fetch_assoc();
- $timecalc = $time - $row['votetime'];
- if ($row['votetime'] == 0) {
- $timecalc = 0;
- }
- if ($timecalc < $vtime) {
- $result = $mysqli->query("INSERT INTO voterecord (ip, accountid, redeemed) VALUES ('" . $ipaddress . "', '" . $account . "', '0')") or die('Error - Could not update vote records!');
- $earnedpoints = true;
- if ($earnedpoints == true) {
- $funct_msg = '<meta http-equiv="refresh" content="0; url=' . $votelink . '">';
- $redirect = true;
- }
- if ($redirect == true) {
- echo $funct_msg;
- }
- }
- }
- }
- ?>
- <?php
- }
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement