Vote With Block IP

12/21/2011 21:25 Bustamante-#1
Any got sistem vote to coins with block ip each 12 hours ?
12/21/2011 23:12 BioNicX#2
There is a script on this forum , trying searching for it, i found it once long time ago but i didn't save it.
12/22/2011 00:42 Synns#3
look it....

Run the following SQL under your charLogon Database
Code:
Code:
CREATE TABLE `voteprotip` (
  `acip` varchar(16) character set utf8 collate utf8_unicode_ci NOT NULL,
  `ctime` int(11) NOT NULL,
  PRIMARY KEY  (`acip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

CREATE TABLE `voteprotacc` (
  `acct` int(10) NOT NULL,
  `ctime` int(11) NOT NULL,
  PRIMARY KEY  (`acct`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;


Code:
    <?php
     
    $sqlHost="localhost";
    $sqlUser="root";
    $sqlPassword="ascent";
    $sqlDatabase="charDB";
     
    $remoteIP = $_SERVER['REMOTE_ADDR'];
    $invalidChar=false;
    $voteIP=false;
    $voteAccount=false;
    $resultText="";
     
    if(!empty($_POST['CharName']))
    {
     
     
      $con_dex = mysql_connect($sqlHost, $sqlUser, $sqlPassword);          
      if (!$con_dex)
      {
             
        $resultText="Could not connect to the SQL.";
     
      } else {
     
         
        $db_bool = mysql_select_db($sqlDatabase, $con_dex);
        if (!$db_bool)
        {
                 
          $resultText="Could not select the Database";        
        } else {
             
          $nameStr = strtolower(mysql_real_escape_string($_POST['CharName']));
          $today = date("mdHi");
          $result = mysql_query("SELECT * FROM characters WHERE name='$nameStr' LIMIT 1", $con_dex);
     
          if($row = mysql_fetch_array($result))
          {
               
            $guidNumber = $row['guid'];
            $acctNumber = $row['acct'];
     
            $res = mysql_query("SELECT * FROM voteprotacc WHERE acct='$acctNumber' LIMIT 1", $con_dex);
            if($res2 = mysql_fetch_array($res))
            {
              $ct = $res2['ctime'];        
              if($today-$ct > 1200)
              {
                $voteAccount=true;
              } else {
                $voteTimeleft = $ct-$today;
                $voteTimeleft = 1200 + $voteTimeleft;
              }
            } else {
              $voteAccount=true;
            }
     
            $res = mysql_query("SELECT * FROM voteprotip WHERE acip='$remoteIP' LIMIT 1", $con_dex);
            if($res2 = mysql_fetch_array($res))
            {
              $ct = $res2['ctime'];        
              if($today-$ct > 1200)
              {
                $voteIP=true;
              } else {
                $voteTimeleft = $ct-$today;
                $voteTimeleft = 1200 + $voteTimeleft;
              }
            } else {
              $voteIP=true;
            }
     
          } else {
            $invalidChar=true;
          }
        }
      }
     
             
      if($voteAccount)
      {
        // if here than player has not voted for account in 12 hours and deserves a voting coin
           
        mysql_query("DELETE FROM voteprotacc WHERE acct='$acctNumber' LIMIT 1", $con_dex);
        mysql_query("DELETE FROM voteprotip WHERE ip='$remoteIP' LIMIT 1", $con_dex);
        mysql_query("INSERT INTO mailbox_insert_queue(sender_guid, receiver_guid, subject, body, stationary, money, item_id, item_stack)
       VALUES ($guidNumber, $guidNumber, 'We appreciate your vote.', 'Enjoy!', 0, 0, 19701, 1)", $con_dex); // 19701 is my voting point item
                   
        mysql_query("INSERT INTO voteprotacc(acct, ctime) VALUES($acctNumber, $today)", $con_dex);
        mysql_query("INSERT INTO voteprotip(acip, ctime) VALUES('$remoteIP', $today)", $con_dex);
       
        $voteIP-false;
      } else {
        if($voteIP)
        {
          // if here player has voted for acc within past 12 hours but has not voted on their currentIP. to control vote points we
          // give them a flask instead of a voting point, as the vote still goes through.
          mysql_query("DELETE FROM voteprotip WHERE ip='$remoteIP' LIMIT 1", $con_dex);
          mysql_query("INSERT INTO mailbox_insert_queue(sender_guid, receiver_guid, subject, body, stationary, money, item_id, item_stack)
         VALUES ($guidNumber, $guidNumber, 'We appreciate your vote.', 'Enjoy!', 0, 0, 33208, 1)", $con_dex); // 33208 Flask of Chromatic Wonder (strip level req and it makes a nice leveling treat)
                           
          mysql_query("INSERT INTO voteprotip(acip, ctime) VALUES('$remoteIP', $today)", $con_dex);
                   
        }    
      }
     
      mysql_close($con_dex);
         
      if($voteIP || $voteAccount)
      {
        header('Location:[url]http://radracer.ipower.com/');[/url]
        die();
      } else {
        if ($invalidChar)
        {
          $resultText="We could not find your character's name in the database.";
        } else {
          $resultText="You are not allowed to vote at this time, please try again in $voteTimeleft minutes.";
        }
      }
     
     
    } else {
     
      $resultText="Pleeasse vote!"; // charname field is empty
    }
     
    ?>
     
    <form action="votescript.php" method="post">
      Charname: &nbsp; &nbsp; </font>
      <input type="text" size="20" maxlength="17" value="" name="CharName" height=""></input>
      <br>
      <input type="submit" value="Vote!"></input>
      <br>
    </form>
    <?=$resultText?>
Quote:
Change line 3, 4, 5, and 6 to your mySql information.
Change line 112 to the (top100 vote supplied url)
Save text as votescript.php, or change line 131 to the page name you will be using.

and as said above include any where on your page.

Note: Line 88 contains coin being sent, line 101 contains lesser item when voting on a diff IP