Register for your free account! | Forgot your password?

You last visited: Today at 23:49

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Prob]Vote 4 Coins

Discussion on [Prob]Vote 4 Coins within the Metin2 Private Server forum part of the Metin2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2015
Posts: 249
Received Thanks: 55
[Prob]Vote 4 Coins

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:
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_HOSTSQL_USERSQL_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>
-!Kontra!- is offline  
Old 05/05/2015, 09:05   #2


 
elite*gold: 0
Join Date: Aug 2013
Posts: 1,701
Received Thanks: 1,385
Wrong = falsch!
Ergo ist deine topmetin IP falsch, also solltest du mal alles überprüfen
ob auch wirklich alles richtig angepasst ist, und jetzt brauchst du auch
nicht Sagen "Ich habe alles richtig angepasst" denn wer dass der Fall
würdest du diesen fehler nicht bekommen.
/exit is offline  
Old 05/05/2015, 09:38   #3
 
elite*gold: 0
Join Date: Feb 2015
Posts: 249
Received Thanks: 55
Komm mir bitte nicht damit.. habe schon einiges mit dem teil versucht aber kein erfolg IP ist richtig usw, auf die db kann er auch connecten... also
-!Kontra!- is offline  
Old 05/06/2015, 12:24   #4
 
elite*gold: 0
Join Date: Feb 2015
Posts: 249
Received Thanks: 55
Keiner ne ahnung...?
-!Kontra!- is offline  
Old 05/06/2015, 13:16   #5
 
elite*gold: 0
Join Date: Apr 2015
Posts: 428
Received Thanks: 361
Also wenn das Developer Example geht, dann nimm doch das:

Quote:
PHP Code:
<?php
$whitelistedIp     
"188.165.186.200";
$serverId         "THE_SERVER_ID";
$privateKey     "THE_PRIVATE_KEY";

DEFINE('SQL_HOST''MEINE ROOT IP');
DEFINE('SQL_USER''root');
DEFINE('SQL_PASS''MEIN DB PW');

$sqlServ mysql_connect(SQL_HOSTSQL_USERSQL_PASS);
if(!
is_resource($sqlServ)) {
    echo 
"Error: MySQL Connection failed." PHP_EOL;
    exit;
}

// 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
$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
        {
            
// 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";
    }
}
?>
-> Obwohl ich jetzt nicht so fan von echo und PHP_EOL bin, aber wenn das der Chuck richtig gemacht hat , müsste das so doch gehen ...

Sonst gib mal die MySQL-Fehler aus und speichere die PHP internen Fehler in die Log
#Metho is offline  
Old 05/06/2015, 13:50   #6

 
elite*gold: 0
Join Date: Dec 2008
Posts: 2,825
Received Thanks: 1,538
Quote:
Originally Posted by Lord Metho View Post
Also wenn das Developer Example geht, dann nimm doch das:



-> Obwohl ich jetzt nicht so fan von echo und PHP_EOL bin, aber wenn das der Chuck richtig gemacht hat , müsste das so doch gehen ...

Sonst gib mal die MySQL-Fehler aus und speichere die PHP internen Fehler in die Log
cloudflare...
.Colossus. is offline  
Thanks
1 User
Old 05/06/2015, 18:23   #7
 
elite*gold: 0
Join Date: Feb 2015
Posts: 249
Received Thanks: 55
Quote:
Originally Posted by Lord Metho View Post
Also wenn das Developer Example geht, dann nimm doch das:



-> Obwohl ich jetzt nicht so fan von echo und PHP_EOL bin, aber wenn das der Chuck richtig gemacht hat , müsste das so doch gehen ...

Sonst gib mal die MySQL-Fehler aus und speichere die PHP internen Fehler in die Log
Von wem haste denn das?
-!Kontra!- is offline  
Old 05/06/2015, 22:34   #8


 
elite*gold: 0
Join Date: Aug 2013
Posts: 1,701
Received Thanks: 1,385
Quote:
Originally Posted by -!Kontra!- View Post
Von wem haste denn das?
Müsste das hier sein wenn ich mich nicht täusche:


Das vote Script funktioniert 1a.
/exit is offline  
Old 05/07/2015, 02:06   #9
 
elite*gold: 1
The Black Market: 127/0/0
Join Date: Dec 2013
Posts: 3,467
Received Thanks: 720
Quote:
Originally Posted by andrs.exit View Post
Müsste das hier sein wenn ich mich nicht täusche:


Das vote Script funktioniert 1a.
Nein das Script funktioniert nicht 1a wegen Cloudflare.
K.A.K.A.S.H.I is offline  
Old 05/07/2015, 02:08   #10
 
elite*gold: 0
Join Date: Feb 2015
Posts: 249
Received Thanks: 55
Öhm ok.. aber kann mir jmd verraten wie man Cronjobs einrichtet? (FreeBSD 10.1)?
-!Kontra!- is offline  
Old 05/07/2015, 02:11   #11
 
elite*gold: 1
The Black Market: 127/0/0
Join Date: Dec 2013
Posts: 3,467
Received Thanks: 720
Quote:
Originally Posted by -!Kontra!- View Post
Öhm ok.. aber kann mir jmd verraten wie man Cronjobs einrichtet? (FreeBSD 10.1)?
crontab -u root -e
i
* * * * * sh /usr/home/game/test.sh (wäre jede Minute)
ESC
ZZ
K.A.K.A.S.H.I is offline  
Old 05/07/2015, 12:04   #12


 
elite*gold: 0
Join Date: Aug 2013
Posts: 1,701
Received Thanks: 1,385
Quote:
Originally Posted by K.A.K.A.S.H.I View Post
Nein das Script funktioniert nicht 1a wegen Cloudflare.
Nicht jeder ist bei Cloudflare und abgesehen vom Hoster funktioniert es 1a.
/exit is offline  
Old 05/07/2015, 13:05   #13
 
elite*gold: 0
Join Date: Feb 2015
Posts: 249
Received Thanks: 55
Ich hab keine Cloudflare.

Das mit diesen Sternchen, muss ich da was bei dem befehl ersetzen?
-!Kontra!- is offline  
Old 05/07/2015, 21:51   #14
 
elite*gold: 1
The Black Market: 127/0/0
Join Date: Dec 2013
Posts: 3,467
Received Thanks: 720
Quote:
Originally Posted by andrs.exit View Post
Nicht jeder ist bei Cloudflare und abgesehen vom Hoster funktioniert es 1a.
Bei topliste.top-pserver wird es aber nicht funktionieren, weil dort Cloudflare aktiv ist.
Das Script geht ohne Probleme aber bei topliste.top-pserver wird es wegen Cloudflare nicht gehen.
K.A.K.A.S.H.I is offline  
Old 05/08/2015, 20:18   #15
 
elite*gold: 0
Join Date: Feb 2015
Posts: 249
Received Thanks: 55
Also gibt es kein richtiges Vote 4 Coins (für Topmetin und toplist-metin2)..?

:/
-!Kontra!- is offline  
Reply


Similar Threads Similar Threads
[Release] Vote 4 Coins (Besseres) (Extern) up to 5 Vote-Sites!
05/12/2020 - Metin2 PServer Guides & Strategies - 83 Replies
Liebe Gemeinde, da von Akaja mein Vote 4 Coins Script damals verbotener Weise hier veröffentlicht wurde, werde ich nun meine neue Version direkt publizieren. Ich weise darauf hin das ich das Script nur anpasse oder Supporte wenn es bei mir gekauft wurde. Sonst habt ihr meinerseits auf keinen Support zu zählen. Demo http://bloody-marry.de/test.html Features IP Kontrolle
[B] Vote 4 Coins Script (IP & Account Abfrage) bis zu 5 Vote Seiten! (Eigenständig)
10/11/2011 - Metin2 Trading - 2 Replies
Ich habe ein Vote System programmiert, bei dem Spieler für Coins voten können. Bis zu 5 Seiten können eingetragen werden (Kann ich beliebig erweitern) Es wird in einer Datenbank die IP & AccountID gespeichert, somit kann man mit einer IP auch nur einmal Voten und pro Account auch nur einmal auch wenn man die IP resetten sollte. Somit ist ein Betrug vollkommen ausgeschlossen. Das Script ist eigenständig und passt somit zu jeder Website!



All times are GMT +2. The time now is 23:49.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.