0 Users online 2,870,549 Total Votes Next votes reset: 1st December

Voting Check - IP Checking - Postback / Callback System

Plugins by Gaming-Toplist, such as voting image, Incentive Voting, Callback, Postback, IP Checking, signature, players online, Voting Script + more!

SETTING UP POSTBACK / CALLBACK SYSTEM

To set your postback URL go to Dashboard and use the Edit option under your site or server.

1. Set your Postback URL (on Gaming-Toplist):

https://YOURDOMAIN/postback.php

To set this link use Edit Settings option from your server page.
The name of file postback.php is just an example and it's not mandatory, feel free to name it as you like.

2. Update your voting link and add parameter to the end:

https://gaming-toplist.com/vote/SiteID/PARAMETER

Your Gaming-Toplist voting link should have an extra / and PARAMETER on end. Copy the LINK from Voting Code and add /USERNAME or /123456 or whatever you keep track of (PARAMETER can be only numbers, letters and _ ). For example if I want to check if username `Razor` votes or not I make the link https://gaming-toplist.com/vote/SiteId/Razor.

3. Our response:

Gaming-Toplist will call your site after voting and the callback will look like this link:

https://YOURDOMAIN/postback.php?gtl_resp=PARAMETER&ip=USERIP

We sent you back the same PARAMETER and the call is made ONLY if the user has voted for you. Your postback.php should UPDATE at this point the user PARAMETER as Valid. In case he didn't voted we don't send any response.

Example:

How your voting link should look like for User ID (first) or Username (second):

https://gaming-toplist.com/vote/SiteId/1234
https://gaming-toplist.com/vote/SiteId/Razor

Our response, due first or second case, will be:

https://YOURDOMAIN/postback.php?gtl_resp=1234&ip=123.123.123.123
https://YOURDOMAIN/postback.php?gtl_resp=Razor&ip=123.123.123.123

Conclusion: The player with account id 1234 or username Razor has voted for you in case we called your postback link with parameter.
123.123.123.123 is the IP address used by the player to vote on Gaming-Toplist.

Please read our PHP example to understand how to capture our response. We will send you the http request callback ONLY when the user has voted for you. If you need help setting this up please contact us.

postback.php example

        <?php
define("DEBUG", 0); //set to 1 to enable debuger
define("LOG_FILE", "_postback.log"); //if debug is enabled will create this file for logs
define("GTL_IP", gethostbyname("gaming-toplist.com")); //This is Gaming-Toplist IP address

$ip_request = $_SERVER['REMOTE_ADDR']; //for Cloudflare $ip_request = $_SERVER["HTTP_CF_CONNECTING_IP"];
if($ip_request == GTL_IP) //check if response is coming from Gaming-Toplist
{
if( DEBUG == true ) {
error_log( date( '[Y-m-d H:i] ' ) . "[OK] Valid callback: $ip_request" . PHP_EOL, 3, LOG_FILE ); 
}

//get the parameters response from us and clean them
$p = preg_replace('/[^A-Za-z0-9\_]+/','',$_GET['p_resp']); //can be only numbers letters and _
$user_ip = preg_replace('/[^0-9\.]+/','',$_GET['ip']); //can be only numbers and dots

//connect to database

//if using MySQL uncomment the following lines (remove slashes)
//$p = mysql_escape_string($p); 
//$user_ip = mysql_escape_string($user_ip);

//or if using MySQLi (change $DB name to correct one)
//$p = $DB->real_escape_string($p);
//$user_ip = $DB->real_escape_string($user_ip);

if( DEBUG == true ) {
error_log( date( '[Y-m-d H:i] ' ) . "[GET] Parameters [p_resp]=$p [ip]=$user_ip" . PHP_EOL, 3, LOG_FILE); 
}
    
    
//Note: we send the parameters $_GET['p_resp'] and $_GET['ip'] back ONLY! if user $p has voted
//here run your code
//first you should check if account $p is valid and exists in your database
//also check if the user has voted in the last 12 hours
//give points to user $p that voted with ip $user_ip
//close database

}
else
{
if(DEBUG == true) {
error_log( date( '[Y-m-d H:i] ' ) . "[Invalid] Invalid request: $ip_request" . PHP_EOL, 3, LOG_FILE); 
}
    
        
//handle invalid request when callback is NOT from Gaming-Toplist.
//ignore or log the $ip_request as invalid request in your database

}
?>
            
        

SETTING UP IP CHECKING SYSTEM

Check whether the user has voted or not insantly through our database!
https://Gaming-Toplist.com/incentive/SERVER_ID/USER_IP

If user has voted in the past 12 hours: true
If the user has not voted in the past 12 hours: false
If the Server ID is not valid: 404
Make sure you check it out before you let your users vote, make sure you've used this script correctly. You can check if you're using the URL correctly by using our Status checker below.

PHP example

$userip = $_SERVER['REMOTE_ADDR']; // Grab user IP
$server_id = "123"; // Your Gaming-Toplist Server ID

$check = "https://Gaming-Toplist.com/incentive/" . $server_id . "/" . $userip;
$voted = @file_get_contents($check);
if($voted == "true") {
echo 'Success!';
}

Check status

Server ID
User IP