Login Not a member? Register

Runescape Top 100 List

Voting Check Postback

We created a simple way for you to check if someone has voted or not.

How does Incentive Voting work?

You need a script on your server which we call once someone votes for you. See the php example for a basic integration based on the default callback below.

Default callback

This method works for most of our website users. Simply pass the voter username/id along with the vote link.

  1. Place your callback url ( web accessable url of the script you created ) within your account settings.
  2. Let your users vote using the following url
    https://www.rsps-list.com/index.php?a=in&u=[RSPS-LIST-USERNAME]&id=[PlayerID]
    • You can pass any of the 3 following variables within the vote link. id=[PlayerID] or postback=[PlayerID] or incentive=[PlayerID]
    • Replace [RSPS-LIST-USERNAME] with your username on https://www.rsps-list.com.
    • Replace [PlayerID] with the ID that you identify your player with.

Dynamic callback

On some systems, you might need some more fine control or need to pass extra dynamic variables back to your callback script. In that case you could use this method.

In such a case, you can either completely drop the id, postback or incentive parameters and pass your own user parameter, or extend your link with a callback parameter.

https://www.rsps-list.com/index.php?a=in&u=[RSPS-LIST-USERNAME]&callback=[base64_encode]
  • In this method you need pass a base64_encode url, which includes whatever you need in your callback url
  • Replace [RSPS-LIST-USERNAME] with your username on https://www.rsps-list.com.
  • Replace [base64_encode] with a url, encoded with php's base64_encode() along with urlencode() to make it safe for url handling.
    $callback_url = urlencode(base64_encode('https://mysite.com/callback_script.php?user=voter_username&extra_parameter=some_value'));
    echo 'https://www.rsps-list.com/index.php?a=in&u=[RSPS-LIST-USERNAME]&callback='.$callback_url;
    

What variables do we sent back to you?

Following variables are sent as $_POST and $_GET in both callback methods

  • secret - Used to validate the request came from RSPS-List. Either TEST when you use our test callback page in developement, or YOUR_API_SECRET which you can find in your dashboard when switching into production.
  • voted - either 1 to indicate a successful vote or 0 for a failed/duplicated one.
  • userip - Contains the voters ip.
  • userid - If present, contains the voters username/ID as passed by you in your vote link via id=[PlayerID] or postback=[PlayerID] or incentive=[PlayerID].
  • custom - If present ( see dynamic callback ), holds reference to the base64_encoded string as passed by you via callback=[base64_encode]. Which you could decode to get your desired parameter if you only allow $_POST or ignore it and simply access your own parameters via $_GET

PHP Example Based on default callback method

In this example we use $_POST to grab the values we send to your script. But $_GET works as well.

<?php
#Example PHP Postback Script
#RSPS-List 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 = '';
$connection = mysqli_connect($host, $db_user, $db_password);
mysqli_select_db($connection, $db_name);

// This is your personal secret key, as found on the RSPS-List dashboard, or the string 'TEST' in case of our Testing script
// Update accordingly to your API secret in production, or the string 'TEST' while developing using our test callback page
$my_secret = '';

// Lets validate the request is coming from RSPS-List. And if not stop here
$secret = isset($_POST['secret']) ? $_POST['secret'] : false;

if ($secret !== $my_secret) 
{		
    exit;
}

// User
$userid = isset($_POST['userid']) ? $_POST['userid'] : null;

// User ip
$userip = isset($_POST['userip']) ? $_POST['userip'] : null;

// User voted on rsps-list.com? 1 = unique vote, 0 = Already voted
$valid = isset($_POST['voted']) ? (int)$_POST['voted'] : 0;

// Make sure the user was not yet rewarded on your system
// For example by checking your reward logs
if (!is_null($userid) && $valid == 1) 
{		
    // Make userid safe to use in query
    $userid = mysqli_real_escape_string($connection, $userid);

    // COUNT rows where reward_date is today
    $result = mysqli_query($connection, "SELECT COUNT(*) FROM `reward_log` WHERE `user` = '$userid' AND `reward_date` >= CURDATE()");
    $rewarded = mysqli_num_rows($result);
		
    // No results means not rewarded yet, so grant reward and set the reward date/time log
    if(!$rewarded) 
    {
         // Grant reward, for example points
        mysqli_query($connection, "UPDATE `users` SET `points` = `points` + 1 WHERE `user` = '$userid'");
			
         // Insert log
        mysqli_query($connection, "INSERT INTO `reward_log` (`user`, `reward_date`) VALUES ('$userid', NOW())");
    }
}

// Close connection
mysqli_close($connection);

?>

Test your Callback

Test your callback script to see if it works with our system.
Please note: The secret we send to validate if requests came from RSPS-List is 'TEST' in this case and not your personal API secret. ( Refer to the PHP example )
To get your API secret when you switch into production, please head to your dashboard.

Keep this blank to use your own IP.