We work hard in order to make your user's experience an easy one to vote for your site AND receive in-game incentives. It is a relatively simple and secure process that can be easily implemented with minimal programming experience.
Overview
Every time a user votes for your site, this information is sent back to your site, so that you know that you are gaining more votes. All information regarding votes is sent to your specified page (User Referral URL) through POST which you can then use to track your site's growth in popularity! On the "modify site" page for your site, all you need to do add a page for the "User Referral URL" field and we'll start sending you information about all of the votes!
Sample Voting Link
<a href="https://onlinegaming.directory/site/{your-site-clean-name}/vote?user={voter's username}">Vote on VPD</a>
Each of the things in curly braces ({}) are values that you will need to provide.
- {your-site-clean-name} - Listed on the "modify site" page under the "Clean Name" section on the left hand panel
- {voter's username} - Something unique from your site that will identify a specific user (will be sent back to you)
Sample Processing Code
<?php
/**
* Sample post-back script for Virtual Pet Directory.
*
* Assumption:
* - you are using the "mysqli" functions for database queries
*/
// The API Key as listed on your "modify site page"
define('API_KEY', 'YOUR_API_KEY');
// Include database connection here
// Verify that the API Key matches what you expect it to
if($_POST['API_KEY'] != API_KEY) {
// The API Key doesn't match, so we should ignore the vote (someone is spoofing the POST)
return;
}
// Now that we know that the request is valid, process the vote
// Check if there was a query string parameter passed (assuming your parameter was "user")
if(isset($_POST['QUERY_STRING']) && isset($_POST['QUERY_STRING']['user'])) {
// It was, so look up the user and give them the benefits
$stmt = $mysqli->prepare('SELECT id FROM users WHERE username = ?');
// Bind the username
$stmt->bind_param('s', $_POST['QUERY_STRING']['user']);
// Run the query
$stmt->execute();
// Bind the result to a $user variable
$stmt->bind_result($user);
// Grab the value
$stmt->fetch();
// Close the query
$stmt->close();
// Check if the user existed
if(!empty($user)) {
// They did, so give them some incentives for voting
$stmt->prepare('UPDATE users SET points = points + 10, votes = votes + 1 WHERE username = ?');
// Bind the user id
$stmt->bind_param('s', $_POST['QUERY_STRING']['user']);
// Run the query
$stmt->execute();
// Close the query
$stmt->close();
}
}
Use the "Contact" link for more information