We have 245 Servers in our list atm, 27 of which are online right now with a total of 8849 Players.

Callback Guide

Our goal is to make it easy and secure for your users to vote for and support your website and receive incentives such as SILK. The system we have in place is quite simple and takes little programming knowledge to impliment.



What happens is a user on your site is given a special voting link with their username or userid added to it. When this user votes we then take this username/userid and send it back to your server as a POST to your specified script to process and credit the user for voting. It is really that simple and you just need to enter URL to the script in your user control panel, implement the example script, and you are ready to go.


Set up a voting url

You can simply switch out the url in your existing voting code from us as found in your control panel
https://silkroad-servers.com/index.php?a=in&u=TOPLIST_USERNAME&id=VOTER_USERNAME_OR_ID

If you quickly want to see if a user voted already simply visit this url
https://silkroad-servers.com/index.php?a=in&u=TOPLIST_USERNAME&ipc=THE_IP_TO_CHECK

As you can see this looks like a normal vote link, but will NOT do any vote, instead it only executes a database query and then returns either 0 or 1 (can be used with cUrl etc.) A 0 returned means the user did not vote on that day when the check was called, 1 means the user voted already.

            <?php

            #Example PHP Postback Script

            // Your Database Connection Details
            $host = 'localhost';
            $db_name = '';
            $db_user = ''; 
            $db_password = '';


            mysql_connect($host, $db_user, $db_password);
            mysql_select_db($db_name);

            function _VoteReward($userId, $userIp, $valid) {    

                if($valid == 1) {  

                    // Make userid safe to use in query
                    $userId = mysql_real_escape_string($userId);
                                                                           
                    // Check if that user voted already
                    // Adjust this query to match your table, column names etc
                    $voted = mysql_fetch_array(mysql_query("SELECT voted FROM vote_list WHERE user = '$userId'"));
                    if(!$voted[0]) {
                        // User has not voted, grant him reward, for example points
                        mysql_query("UPDATE votepoints SET points = points + 1 WHERE user = '$userId'");
                    }
                    else {
                        // Do whatever you want if he voted already. Maybe a log of false votes
                    }

                }

            }

            //-------------------------- Don't change anything below this! ----------------------------- //

            $ipsWhitelist = array('92.222.87.226'); 

            $userId = isset($_POST['userid']) ? $_POST['userid'] : null;
            $userIp = isset($_POST['userip']) ? $_POST['userip'] : null;
            $valid  = isset($_POST['voted']) ? intval($_POST['voted']) : 0;

            $result = false;
            if (!empty($userId) && !empty($userIp)) {

                if (in_array($_SERVER['REMOTE_ADDR'], $ipsWhitelist)) {
                $result = true;
                _VoteReward($userId, $userIp, $valid);
                }

            }

            if ($result) {
                echo 'OK';
            }

            //Close Connection
            mysql_close();

            ?>
         

What is UCVS?

UCVS is a more complex implementation of our callback voting system which also supports other toplists, does all the security checks for you and is easy to uses and installed faster than the example script.

All you have to do is download it from the github, upload it to your folder and run the install script. (You can find mor einformation on that on the github or inside the readme of the archive). After that all you have to do is change your vote links like described under "Basics" and edit your Callback URL to the listener url UCVS tells you after installation.


How it works:

When a user clicks a vote button on your page, your ServerID and UserID will be passed to the Toplist Site. After the user successfully voted the Toplist site checks if the user has already voted with this IP address, if not the Toplist site sends an answer with the UserID to your UCVS installation. UCVS then checks whether the UserID has already voted during the configured timeframe and whether there possibly is still a cooldown. If everything is okay, the user is rewarded for his vote with VotePoints or Silk (Only for Silkroad Online Servers)!

For more information about UCVS visit this link: UCVS - Unified Callback Vote Script

Do you have a project? We are here to help!