Advertisement
tok124

votescript

Apr 17th, 2015
218
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start();
  3. @include('../config/db_conf.php');
  4. $vp = $_POST['vp'];
  5.  
  6. $conn = mysqli_connect($host, $dbuser, $dbpass, $dbname);
  7.  
  8. if(isset($_POST['votetest'])) {    
  9.     $vote_last_time = "SELECT vote_time FROM tokdev.vote_cooldown WHERE account = '" . $_SESSION['username'] . "'";
  10.     $result = $conn->query($vote_last_time);
  11.     if ($result->num_rows > 0) {
  12.     if($vote_last_time >= time() - 60 * 60 * 12) {
  13.     $new_time = "UPDATE tokdev.vote_cooldown SET vote_time=now() WHERE account = '" . $_SESSION['username'] . "'";
  14.     $addvp = "UPDATE auth.account SET vp = vp+$vp WHERE account = '" . $_SESSION['username'] . "'";
  15.     } else {
  16.         echo "You can't vote now";
  17.     }
  18. }
  19. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement