[Help] Tutorial To Get Tolls for Voting

Results 1 to 3 of 3
  1. #1
    Enthusiast lpabon is offline
    MemberRank
    Oct 2011 Join Date
    28Posts

    [Help] Tutorial To Get Tolls for Voting

    Anyone able to make a tutorial on how to set this up this is what i found on voting sites but what would i need to do on my end?

    "http://topg.org/voting_check#pb"
    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.



    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:
    Code:
    http://topg.org//in-SITEID-PARAMETER
    The callback to your site will be HTTP request and will look like this:
    [CODE]
    Code:
    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:
    Code:
    http://topg.org//in-SITEID-1234
    (in this example 1234 can be the player account id number)
    Example: How our response will be:
    Code:
    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

    Code:
    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=...&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
    Code:
    $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
    }


  2. #2
    L][Files ROhanFiles Dev soulsimbol is offline
    MemberRank
    Apr 2010 Join Date
    Ro-RULocation
    360Posts

    Re: Tutorial To Get Tolls for Voting

    Thank you for this effort .

  3. #3
    invincible.js cruseX is offline
    MemberRank
    Feb 2010 Join Date
    238Posts

    Re: Tutorial To Get Tolls for Voting

    @soulsimbol

    He asked for a "How to" and quoted than the tutorial of topg >.<



Advertisement