Ontop 500 banner
INCENTIVES structure and usage...

Postback Check

A postback request is sent whenever a player complete the captcha, once the vote count in the toplist our server will send a post request telling your server that a player has voted

1. Introduction

Login to your account panel and set a postback link for your server as follows

http://yourserver.com/path-to-your-postback-page

The postback file will be the path where you put the verification code and progress to giving the points to your player

2. Sending parameters

Our system will only send a postback request if you put a custom parameter at the end of your vote code as follows

http://ontop500.com/in-YOUR_SITE_ID&YOUR_CUSTOM_PARAM=YOUR_CUSTOM_VALUE
  • YOUR_SITE_ID - is the unique identifier that can be found in your account panel or in/out pages
  • YOUR_CUSTOM_PARAM - this param can be whatever you want USERID, USERNAME, USERIP you can put as many parameters you want but our system will only take into consideration the last parameter
  • YOUR_CUSTOM_VALUE - the value that will be returned as true once a player complete the vote session

3. Reading postback result & Implementation

As already mentioned our system will only send a postback in case your player complete his votes session. We send the results as $_POST values as follows

<?php $_POST['custom'//The value you sent us from your vote panel ?> <?php $_POST['status'//True or False, true if player completed the vote session, false if there was a problem and the vote did not counted ?>

Before completing a vote session make sure to check if post data comes from our website to avoid exploitations as follows

<?php
$verified 
= array("verified.ontop500.com"); // Verify if request comes from our website to avoid exploitation

if(!in_array($_SERVER["REMOTE_ADDR"],$verified))
    exit;

$voter $_POST["custom"]; // voter unique identifier sent in your vote code
$status $_POST["status"]; // TRUE/FALSE, tells you if a plyer completed his vote session

//Establishing a mysql connection
function connect()
{
    
$con mysqli_connect('localhost''username''password''database');
    if (!
$con) {
        
printf("Connect failed: %s\n"mysqli_connect_error());
        exit();
    }
    return 
$con;
}

//Check if is valid to vote
function vote_valid($time){
    if (
time() > $time)
        return 
true;
    return 
false;
}
// if successfull vote reward your user, use your own database!
if($status){
    
// check if user exist
    
if($stmt connect()->prepare("SELECT * FROM user_table WHERE `user_id` = ?")){
        
$stmt->bind_param("i"$voter);
        
$result $stmt->get_result();
        if(
$result !== false){
            if(
$stmt connect()->prepare("SELECT `time` FROM `vote_table` WHERE `user_id` = ?")){
                
$stmt->bind_param("i"$voter);
                
$result $stmt->get_result();
                
$date 0;
                while (
$data $result->fetch_assoc()) {
                    if(
vote_valid($data['time']))
                        
$date $data['time'];
                }
                if(
vote_valid($date)){
                    
//reward player
                
}
                else{
                    
//tell player the vote could not be completed
                
}
            }
        }
        
$stmt->close();
    }
}
?>

Pingback Check

Pingback system is probably the easiest way for telling if a player has voted based on his IP, you can check that manually by accessing our pingback plugin.

Warning! only one check/ip can be done per minute to avoid our system overflow and we suggest you to make sure you are checking the right ip

1. Introduction

By accessing the following link you will be able to retrieve a bunch of variables that you can later use on your server

http://ontop500.com/pingback/YOUR_SITE_ID-PLAYER_IP
  • YOUR_SITE_ID - you can find your site id in your account panel
  • PLAYER_IP - we are not saving ips physically in our database and they are encrypted so all user data will be safe on our side, in this variable you should pass your player IP

2. Result Example

Accessing the following link will result into a bunch of code that i'm going to explain later how it can be used

http://ontop500.com/pingback/57-127.0.0.1

Result will be

57--127.0.0.1--1516098725--B736BE75991F852833E1E96F360E3C09EA07AEBC

At first sight you might not know what to do with such bunch of code, well let's go to the next step

3. Reading the result

Using the following code it will retrieve the result and turn it into an array

<?php $data explode("--"file_get_contents("https://ontop500.com/pingback/YOUR_SITE_ID-PLAYER_IP")); ?>

Variables returned are the following:

  • $data[0] - Your site ID
  • $data[1] - Your player ip parsed trough the link
  • $data[2] - Timestamp of the last time whn the following player has voted
  • $data[3] - A unique token of your session to prevent any kind of exploits
On Top 500 advertise your server
On Top 500 advertise your server