After you set up your postback script on your server, and put the link to it inside your settings you need to use the Postback Button Code.
<a href="http://www.toprsps.com/index.php?a=in&u=YOUR_SITE_NAME&id=[PlayerID]">
Code [PlayerID]
contain the ID that you identify your player with.
Example Player "John" has the account ID "1417" the link would be:
<a href="http://www.toprsps.com/index.php?a=in&u=YOURSITENAME&id=1417">
That means you have to dynamically put the players account ID into that link code, for example like this:
<?php echo '"http://www.toprsps.com/index.php?a=in&u=YOUR_SITE_NAME&id=' . $_SESSION['PlayerID'] . '"' ?>If you store the ID ("1417") inside the Session Variable.
http://www.toprsps.com/index.php?a=in&u=SiteName&ipc=IPtoCheck
Replace SiteName
with the ID assigned to your website, and IPtoCheck
with the user's IP.
The page will return 0 if the user has not voted today, and 1 if they have.
$result = file_get_contents("http://www.toprsps.com/index.php?a=in&u=SiteName&ipc=IPtoCheck"); if($result == 1) { //User has voted in last 12H - reward the user } else { //This user hasn't actually voted, perhaps make a log about this. }It's recommended that you keep a local log so you will not give a reward twice for the same vote.
<?php #Example PHP Postback Script #Toprsps does not take responsibility or liability for the use of this php snippet // Your Database Connection Details $host = 'localhost'; $db_name = ''; $db_user = ''; $db_password = ''; mysql_connect($host, $db_user, $db_password); mysql_select_db($db_name); function _VoteReward($userId, $userIp, $valid) { if($valid == 1) { // Make userid safe to use in query $userId = mysql_real_escape_string($userId); // Check if that user votes already // Adjust this query to match your table name etc $voted = mysql_fetch_array(mysql_query("SELECT voted FROM vote_list WHERE user = '$userId'")); if(!$voted[0]) { // User has not voted, grant him reward, for example points mysql_query("UPDATE votepoints SET points = points+1 WHERE user = '$userId'"); } } } //-------------------------- Don't change anything below this! ----------------------------- $Whitelist = array('198.143.128.25'); $userId = isset($_POST['userid']) ? $_POST['userid'] : null; $userIp = isset($_POST['userip']) ? $_POST['userip'] : null; $valid = isset($_POST['voted']) ? intval($_POST['voted']) : 0; $at_refc = isset($_POST['at_refc']) ? $_POST['at_refc'] : null; $result = false; if (!empty($userId) && !empty($at_refc)) { if (in_array($at_refc, $Whitelist)) { $result = true; _VoteReward($userId, $userIp, $valid); } } if ($result) { echo 'OK'; } //Close Connection mysql_close(); ?>