Voting Check

Use Postback, Check Username/IP

Postback

To set your postback URL go to My servers -> edit.

1. Set your Postback URL:

http://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.

We sent you ONLY if the user has voted for you. Your postback.php should UPDATE the user PARAMETER as Valid. In case he didn't voted we don't send any response.

2. We sen all parameters in Post

"IP","datetime","username"

Example:

If you found some holse/bugs where users can play unfair please report to use so we could upgrade.

postback.php example


    define("DEBUG", 0); //set to 1 to enable debuger
    define("LOG_FILE", "_postback.log"); //if debug is enabled will create this file for logs
    $onlinetop=gethostbyname(parse_url('http://Onlinetop.net', PHP_URL_HOST));

    $ip_request = $_SERVER['REMOTE_ADDR']; //for playing fare
    $ip=$_POST['ip'];
    $datetime=$_POST['datetime'];
    $username=$_POST['username'];

    if ($onlinetop == $ip_request){
        if(!empty($ip) && !empty($datetime) !empty($username)) //check if not empty
        {

            // here you can validate what you get here is many different ways
            // for example
            if (filter_var($ip, FILTER_VALIDATE_IP) && filter_var($username, FILTER_SANITIZE_STRING))
            {
                // for datetime validation you can check http://stackoverflow.com/questions/14504913/verify-valid-date-using-phps-datetime-class
                //connect to database
                //here run your code
                //first you should check if account $username is valid and exists in your database
                //you can check Extra if the user has voted in the last 24 hours
                //give points to user  that voted with ip
                //close database
            }
        }
    }
    else
    {
        //handle invalid request when callback is NOT from OnlineTop.net
        //ignore or log the $ip_request as invalid request in your database
    }


Check Username/IP

Check username or IP voting records directly on our database

Just query this page to use it:

http://OnlineTop.net/process_vote_check.php?siteid=SITE_ID&username=USER_NAME


The page will return result if the user has voted in the last X hours and blank 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.

parameters

                siteid=SITE_ID       // your site ID  you can check it in "My server"
                username=USER_NAME   // username
                userip=USER_IP       // you can check instead of username user_ip  or use it both
                time=Nr              // by default is 1 day , (example time=30 will give you result of 30days)
                type=xml/json        // how do you want return all the list xml or json  by default "xml"

                example 1: http://OnlineTop.net/process_vote_check.php?siteid=1&username=Jon&time=2&type=xml
                // in 1) you get how much times Jon have voted in 2days and return xml format
                example 2: http://OnlineTop.net/process_vote_check.php?siteid=1&username=Jon&userip=123.112.12.21&type=json
                // in 2) you get if Jon with Ip=123.112.12.21 has voted in 24h by default and return result in json format
            

example