What is Voting Check


This system checks if players are voting for your site / server on the anti-cheat gateway.
There are two ways to check: Postback Checking or Direct IP Checking.

Minecraft Votifier


For Minecraft we have a special plugin called votifier. You don't need to use Postback or IP checks. Just configure and enable Votifier for your MC server on your Account Panel. To test Minecraft votifier use Test Votifier Tool .



Postback Checking

To set your postback URL please Login and Edit your site configuration.

How Postback Checking works


Set your Postback URL:

http://YOURDOMAIN/postback.php


Your vote link should look like this:

http://topg.org//in-SITEID-PARAMETER


The callback to your site will be HTTP request and will look like this:

http://YOURDOMAIN/postback.php?p_resp=PARAMETER


Just change YOURDOMAIN to your site url and the PARAMETER to your player account id or game username.
The PARAMETER (can be only numbers, leters and _ )


Example: How your voting link should look like:

http://topg.org//in-SITEID-1234

(in this example 1234 can be the player account id number)

Example: How our response will be:

http://YOURDOMAIN/postback.php?p_resp=1234

(confirmation sent for player account id 1234. He has voted for you.)

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


define(TOPG_IP,"174.36.33.242"); //This is TopG.org IP address, do not change it
$ip_request = $_SERVER['REMOTE_ADDR'];
//first we check if the response is coming from Topg.org
if($ip_request == TOPG_IP)
{
 //connect to database
 //get the parameter response from us and clean it (can be only numbers leters and _)
 $p = mysql_escape_string(preg_replace('/[^A-Za-z0-9_]+/','',$_GET['p_resp']));
 //Note: we send the parameter $_GET['p_resp'] back ONLY! if user $p has voted for you

 //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
 //close database
}
else
{
 //handle invalid request when callback is NOT from TopG.
 //ignore or log the $ip_request as invalid request in your database
}


Direct IP Checking

Check user IP voting records directly on our database

How Direct IP Checking works


Just query this page:

http://topg.org/check_ip.php?siteid=SITEID&userip=UserIP


The page will return 1 if the user has voted in the last 12 hours and 0 if he did not.
In case of any error like missing parameter or invalid values the page will return blank.
Best practice is to define a delaied time to check for the user IP, 10 minutes after user has voted. To do that you will need to create a function that runs every 10 minutes and checks ONLY the users that voted 10 minutes or more ago.
Probably a good solution for delay check is to Create a Cron Job or Windows Task Scheduler depending on your OS.
Our example is simply just for the call + result but we can help with more if needed. Just contact us.

IP Check PHP example


$userip = $_SERVER['REMOTE_ADDR']; //get your player or user IP address
define(TOPG_CHECK,"http://topg.org/check_ip.php?siteid=SITEID&userip=".$userip); 
//replace SITEID with your site's ID on TopG then do the next check
$voted = @file_get_contents(TOPG_CHECK); //check url to see response for UserIP if($voted) { echo 'User with IP '.$userip.' has voted!'; //user has voted, give points }