Give every player a personal vote link. When they vote for your server here, we instantly tell your website who voted, so your script can hand out Silk, items or points. No manual checks, no screenshots.
Take your normal vote link and add &id= followed by the player's account name or id. Your website fills this in for whoever is logged in.
<a href="https://silkroad-servers.com/index.php?a=in&u=myserver&id=<?php echo urlencode($player_name); ?>">Vote for us</a>This small script receives our ping and gives the reward. Upload it to your site, for example as myserver.com/vote_callback.php, and fill in your database details.
<?php // vote_callback.php - Silkroad Servers vote reward (vSRO / SQL Server) // 1) Choose a long random secret. Put the SAME value at the end of the // callback URL you save on Silkroad Servers (see step 3). $SECRET = 'CHANGE-ME-to-a-long-random-string'; $SILK = 10; // reward per vote if (!isset($_GET['key']) || !hash_equals($SECRET, (string)$_GET['key'])) { http_response_code(403); exit('bad key'); } $voted = isset($_REQUEST['voted']) ? (int)$_REQUEST['voted'] : 0; $userid = isset($_REQUEST['userid']) ? trim($_REQUEST['userid']) : ''; // voted = 1: a new vote was counted. voted = 0: already voted today. if ($voted !== 1 || $userid === '') { exit('nothing to reward'); } $db = new PDO('sqlsrv:Server=127.0.0.1;Database=SRO_VT_ACCOUNT', 'DB_USER', 'DB_PASS'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Find the account (TB_User.StrUserID is the login name) $q = $db->prepare('SELECT JID FROM TB_User WHERE StrUserID = ?'); $q->execute(array($userid)); $jid = $q->fetchColumn(); if (!$jid) { exit('unknown account'); } // Reward once per 24 hours (create the log table once - see below) $q = $db->prepare('SELECT COUNT(*) FROM _VoteRewardLog WHERE JID = ? AND RewardedAt > DATEADD(HOUR, -24, GETDATE())'); $q->execute(array($jid)); if ((int)$q->fetchColumn() > 0) { exit('already rewarded'); } $db->prepare('UPDATE SK_Silk SET silk_own = silk_own + ? WHERE JID = ?')->execute(array($SILK, $jid)); $db->prepare('INSERT INTO _VoteRewardLog (JID, RewardedAt) VALUES (?, GETDATE())')->execute(array($jid)); echo 'ok'; /* Run once in SQL Server Management Studio: USE SRO_VT_ACCOUNT; CREATE TABLE _VoteRewardLog (ID INT IDENTITY PRIMARY KEY, JID INT NOT NULL, RewardedAt DATETIME NOT NULL); */
<?php // vote_callback.php - Silkroad Servers vote reward (MySQL / MariaDB) $SECRET = 'CHANGE-ME-to-a-long-random-string'; // same value as in your callback URL $POINTS = 10; if (!isset($_GET['key']) || !hash_equals($SECRET, (string)$_GET['key'])) { http_response_code(403); exit('bad key'); } $voted = isset($_REQUEST['voted']) ? (int)$_REQUEST['voted'] : 0; $userid = isset($_REQUEST['userid']) ? trim($_REQUEST['userid']) : ''; if ($voted !== 1 || $userid === '') { exit('nothing to reward'); } $db = new PDO('mysql:host=localhost;dbname=YOUR_DB;charset=utf8mb4', 'DB_USER', 'DB_PASS'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $q = $db->prepare('SELECT COUNT(*) FROM vote_rewards WHERE userid = ? AND rewarded_at > NOW() - INTERVAL 24 HOUR'); $q->execute(array($userid)); if ((int)$q->fetchColumn() > 0) { exit('already rewarded'); } $db->prepare('UPDATE users SET points = points + ? WHERE username = ?')->execute(array($POINTS, $userid)); $db->prepare('INSERT INTO vote_rewards (userid, rewarded_at) VALUES (?, NOW())')->execute(array($userid)); echo 'ok'; /* Run once: CREATE TABLE vote_rewards (id INT AUTO_INCREMENT PRIMARY KEY, userid VARCHAR(64) NOT NULL, rewarded_at DATETIME NOT NULL, KEY (userid, rewarded_at)); */
voted. A ping with voted=0 means the vote did not count — for example the same player id already voted today from another connection — so never reward on 0. Keep the 24-hour log too: it is your own guarantee that nobody collects twice.Log in, open Edit account, and paste the full address of your script — including your secret — into the Callback Vote Check field, then save.
?key= part is your password: only Silkroad Servers knows the full URL, so nobody else can call your script and give themselves Silk. Use something long and random, and change it if it ever leaks.?key=...&voted=1&userid=YourTestAccount — it should print ok. If it does, re-check the URL saved in step 3.| Field | Value |
|---|---|
voted | 1 = a new vote was counted · 0 = the vote did not count (this player id already voted today) |
userid | Exactly what was after &id= in the vote link |
userip | The voter's IP address |
111.90.156.62. Your script must answer within 5 seconds with HTTP 200; redirects are followed (up to 3). Addresses on private networks (localhost, 10.x, 192.168.x …) are not called.Yes: https://silkroad-servers.com/index.php?a=in&u=YOUR_USERNAME&ipc=IP_TO_CHECK answers 0 (not voted yet) or 1 (already voted). It redirects once, so tell your HTTP client to follow redirects. It does not cast a vote.
Usually yes. If you use "Bot Fight Mode" or a strict WAF, add a rule that skips checks for requests to your callback script path, or for our server IP 111.90.156.62.
No. Only you, the server owner, need an account here. Players just click the link.
Own a Silkroad server?
Put it in front of thousands of players hunting for their next home — listing is free, forever.