PeaceMaker 121 Posted March 9, 2015 Share Posted March 9, 2015 can anyone give me a help on who to add vote4coins from this website ? https://topmetin.org its really complicated and they didnt explained how to use it aswell thanks Link to comment Share on other sites More sharing options...
metin2team 766 Posted March 9, 2015 Share Posted March 9, 2015 https://topmetin.org/site/developer do you still need help? Link to comment Share on other sites More sharing options...
PeaceMaker 121 Posted March 9, 2015 Author Share Posted March 9, 2015 yes please , i cant manage to fix it xD Link to comment Share on other sites More sharing options...
PeaceMaker 121 Posted March 9, 2015 Author Share Posted March 9, 2015 its just this : Replace the todo points with your own code. what does this means Link to comment Share on other sites More sharing options...
Premium Shogun 4588 Posted March 9, 2015 Premium Share Posted March 9, 2015 There you should add the code to reward the voter, for example, a query adding cash to his account. Link to comment Share on other sites More sharing options...
PeaceMaker 121 Posted March 9, 2015 Author Share Posted March 9, 2015 i added this but its not working $sqlCmd = "UPDATE account.account SET coins='".$Coins."' WHERE id='".$_POST['accID']."' LIMIT 1" Link to comment Share on other sites More sharing options...
Premium Shogun 4588 Posted March 9, 2015 Premium Share Posted March 9, 2015 Did you establish a connection to the database? Also, you should escape POST variables Link to comment Share on other sites More sharing options...
PeaceMaker 121 Posted March 10, 2015 Author Share Posted March 10, 2015 i think the script they give isnt complete too bad im not good with php would be great if someone can help <?php $whitelistedIp = "188.165.186.200"; $serverId = "123"; $privateKey = "123"; // check if the whitelisted IP is right and the POST elements exist if ($whitelistedIp == $_SERVER["REMOTE_ADDR"] && isset($_POST["TYPE"]) && isset($_POST["TIMESTAMP"]) && isset($_POST["HASH"])) { // it's a vote if ($_POST["TYPE"] == "VOTE" && isset($_POST["USER_ID"])) { // check the received hash if ($_POST["HASH"] == md5(sprintf("%s|%s|%s|%s|%s", $_POST["TYPE"], $serverId, $_POST["TIMESTAMP"], $_POST["USER_ID"], $privateKey))) { // yeah right hash $userId = $_POST["USER_ID"]; // the user id // TODO: do what you want to do } else { // no, no, no ... wrong hash ;-( echo "WRONG HASH"; } } // it's a click else if ($_POST["TYPE"] == "CLICK") { if ($_POST["HASH"] == md5(sprintf("%s|%s|%s|%s", $_POST["TYPE"], $serverId, $_POST["TIMESTAMP"], $privateKey))) { // yeah right hash // TODO: do what you want to do } else { // no, no, no ... wrong hash ;-( echo "WRONG HASH"; } } // it's nothing else { echo "NOTHING IS RIGHT"; } } ?> Link to comment Share on other sites More sharing options...
PeaceMaker 121 Posted March 12, 2015 Author Share Posted March 12, 2015 uppp Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted March 12, 2015 Premium Share Posted March 12, 2015 First of all, you have to create a new file on your site called whatever you like. eg: tm_api.php Second, you have to put the code specified by them there. I am using this code: <?php session_start(); include "./inc/core.inc.php"; $allowedIP = "188.165.186.200"; $serverID = "ID"; $privateKey = "KEY"; if ($allowedIP == $_SERVER["REMOTE_ADDR"] && isset($_POST["TYPE"], $_POST["TIMESTAMP"], $_POST["HASH"])) { if ($_POST["TYPE"] == "VOTE" && isset($_POST["USER_ID"])) { if ($_POST["HASH"] == md5(sprintf("%s|%s|%s|%s|%s", $_POST["TYPE"], $serverID, $_POST["TIMESTAMP"], $_POST["USER_ID"], $privateKey))) { $userId = (int)$_POST["USER_ID"]; $vote->DoVote($userId); } } } ?> Where: $serverID is your unique server id from topmetin.org. How you can find it? Go on the site, log in and click on the Serverlist link from header. There you will find your server and the Votelink. The Votelink have this structure: https://topmetin.org/site/vote/serverID_serverName Copy serverID and paste it in your file. Also, you will find, near the Votelink, the private key. Copy that key to your file too and replace KEY (keep quotation). Now replace $vote->DoVote($userId); with your code. eg: mysql_query("UPDATE account.account SET coins=coins+5 WHERE id='$userId'"); Where 5 is how coins you want to give for every vote. Tip: Do some logs to track votes. Also, you should force them to vote only once at 12 hours per account (even if topmetin.org does that already). Also, replace include "./inc/core.inc.php"; with your file which connects to database (if you don't know which is take it from another file -.- ). Now the vote link. First of all, put the link in a file which checks if a user is logged in (like User Panel or something). The link should look like that: https://topmetin.org/site/vote/serverID_serverName/userID You should be able to get userID from sessions or something. And the last step: Go to the site and click on the Edit icon from your server (it's somewhere in the right) and in the field called API-Link (optional) put your API file link (eg: http://yourserver.com/tm_api.php). 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now