How to use the API
Here we will show you both which ip's that successfully voted and which ones that voted but failed, you will also be able know what went wrong.
With our pingback system you will know each time a voter has voted and which ip and/or username they have used.
A lot of things can go wrong when you vote, so all votes might not count, i have listed below the two most common things that result in a failed vote even when you enter the captcha and vote correctly.
Make sure that cookies and javascript is enabled in your browser!
Example link for vote: http://top.dcohen.net/server/{serverid}/{username}
{serverid} with your server voting ID, {username} - output the username of the guy who's voting on the Link from your website.
Code Example
switch($_SERVER['REMOTE_ADDR']){
case gethostbyname("http://top.dcohen.net");
$username = isset($_POST['username']) ? trim($_POST['username']) : '';
$status = isset($_POST['status']) ? (int)$_POST['status'] : 0; // 1 - voted, 0 - not voted.
$ip = isset($_POST['ip']) ? trim($_POST['ip']) : '';
break;
default:
$username = isset($_POST['username']) ? trim($_POST['username']) : '';
$status = isset($_POST['status']) ? (int)$_POST['status'] : 0;
$ip = isset($_POST['ip']) ? $_POST['ip'] : '';
// this is not from our pingback
}
if(!empty($username)) {
$valid_vote = true;
if(isset($status) && ($status == 0)){
$valid_vote = false;
}
if($valid_vote) {
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)){
// give reward
}
}
}
