Hallo Freunde...
Ich hab ein problem beim Vote 4 Coins und iwie bekomm ichs einfach nich hin..
Ich nutze das aus dem metin2-dev releasten Vote4Coins script für TopMetin.
Aber iwie will das nich ganz klappen.
Es steht immer auf der Homepage "Wrong Topmetin IP". Wenn ich allerdings dieses Script teste auf TopMetin (Also die Api teste bei dieser Developer seite), dann klappt alles und bekomme VoteCoins... Warum zeigt er mir Wrong Topmetin IP an?
Script:
Ich hab ein problem beim Vote 4 Coins und iwie bekomm ichs einfach nich hin..
Ich nutze das aus dem metin2-dev releasten Vote4Coins script für TopMetin.
Aber iwie will das nich ganz klappen.
Es steht immer auf der Homepage "Wrong Topmetin IP". Wenn ich allerdings dieses Script teste auf TopMetin (Also die Api teste bei dieser Developer seite), dann klappt alles und bekomme VoteCoins... Warum zeigt er mir Wrong Topmetin IP an?
Script:
PHP Code:
<div id="con-top">Vote 4 Coins</div>
<div id="con-mid">
<?php
$_SERVER['REMOTE_ADDR'] = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];
DEFINE('SQL_HOST', 'MEINE ROOT IP');
DEFINE('SQL_USER', 'root');
DEFINE('SQL_PASS', 'MEIN DB PW');
$sqlServ = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS);
if(!is_resource($sqlServ)) {
echo "Error: MySQL Connection failed." . PHP_EOL;
exit;
}
$VoteBonusCoins = 100; // Standard Coins
$topmetin = '188.165.186.200';
$serverId = '1180';
$privateKey = 'MEIN-KEY';
// check if the whitelisted IP is right and the POST elements exist
if($topmetin == $_SERVER['REMOTE_ADDR']) {
if($_POST['TYPE'] == 'VOTE' && isset($_POST['USER_ID'])) {
$hash = md5(sprintf('%s|%s|%s|%s|%s', $_POST['TYPE'], $serverId, $_POST['TIMESTAMP'], $_POST['USER_ID'], $privateKey));
if($_POST['HASH'] == $hash) {
// Everything okay, handle
$GetPlayerCoins_SQL = "SELECT votecoins FROM account.account WHERE id = '".$_POST['USER_ID']."'";
$GetPlayerCoins_Query = mysql_query($GetPlayerCoins_SQL,$sqlServ);
$GetPlayerCoins_Result = mysql_fetch_array($GetPlayerCoins_Query);
$PlayerCoins = $GetPlayerCoins_Result['votecoins'] + $VoteBonusCoins;
$PlayerNewCoins_SQL = "UPDATE account.account
SET votecoins = $PlayerCoins
WHERE id = '".$_POST['USER_ID']."'";
mysql_query($PlayerNewCoins_SQL,$sqlServ);
echo "Debug: Account with id '" . $_POST['USER_ID'] . "' gets " . $VoteBonusCoins . " Coins." . PHP_EOL;
#Log Entry
$Log_SQL = "INSERT INTO `log`.`vote_cron`(`date`, `vuid`, `coins`) VALUES(NOW(), '" . $_POST['USER_ID'] . "', '" . $VoteBonusCoins . "');";
$Log_Query = mysql_query($Log_SQL);
} else {
echo 'Wrong hash';
}
} else {
echo 'Unhandeld type';
}
} else {
echo 'Wrong topmetin ip';
}
?>
</div>
<div id="con-bot"></div>