Example #2Below is an example code in PHP how to retrieve and print out the latest ip's that have voted since last time you checked. Once an ip has been fetched through report1.php it will not show up again unless the user has successfully voted again. You will be required to have some programming knowlage. Replace "YOUSITEIDNUMBER" with your gtop100 account site-id number and "YOURPASSWORD" with your gtop100 account password.
If you change the url from report1.php to report2.php the script will collect all successfully voted ip's the last 30 days.<?php $xml = simplexml_load_file("http://www.gtop100.com/report1.php?siteid=YOUSITEIDNUMBER&pass=YOURPASSWORD"); if ($xml->errorcode == 0) { $cnt = count($xml->entries->entry); for ($i = 0; $i < $cnt; $i++) { print($xml->entries->entry[$i]->ip); print(" - "); print($xml->entries->entry[$i]->time); print("<br>"); } } else { print($xml->errormessage); } print("<br>");
?>
We have provided two ways of doing it, incentive postback and IP checking.
Incentive Postback
How does incentive postback work?
When users come in to vote, you can append their ID to the voting page using the incentive GET variable:
e.g. http://www.top100arena.com/in.asp?id=xxx&incentive=1000
Fill out the Incentive URL field with the EXACT URL you want your user ID posted to.
e.g. http://www.yoursite.com/votingpage.php?postback=
You can do this when editing your site, just log in to access it
The result will be an HTTP request to
e.g. http://www.yoursite.com/votingpage.php?postback=1000
This will happen at the exact time that the user votes
Example PHP Code
This would be the contents of /votingpage.php in the above example
<?php//////// Example Post-Back Script for Top 100 Arena
// include database connection here
// this is the variable we pass back to you that
// contains the value you passed to us with the vote link$user = mysql_escape_string($_POST['postback']);
// check if the user has voted$check_voted = mysql_fetch_array(mysql_query("SELECT vote FROM users WHERE username = '$user'"));
if ($check_voted[0] == 0) { // if they haven't voted
// credit the user for voting, like giving +100 money as in the example
mysql_query("UPDATE users SET money = money + 100, vote = '1' WHERE username = '$user'");
}
?>
IP Checking
We also provide a facility for you to check if a certain IP has voted.
Just query this page:
http://www.top100arena.com/check_ip.asp?id=YourSiteID&ip=UsersIP
Replace YourSiteID with the ID assigned to your website, and UsersIP with the user's IP.
The page will return 0 if the user has not voted today, and 1 if they have.