das backend.php script lasse ich alle 2 Minuten mit cron-job.org ausführen
1. Problem bein Vote fenster steht
Code:
Warning: mysql_query() expects parameter 2 to be resource, null given in /var/customers/webs/w259730/vote4us.php on line 31
Code:
Zeile 31 ist: $result = mysql_query($CheckVoteLog_SQL, $sqlHp);
Wo ist das problem? Ich habe den richtigen Vote-Link + API + SITEID eingetragen .. auch mein Navicat Daten sind eingetragen
Nur ich wusste nicht so recht was bei $hpDB = 'account'; hinkommt (Das Account habe ich da eingefügt vorher war es leer)
In Navicat unter Account habe ich auch v4c mit den 3 Spalten drinnen..
Bin ratlos.. jemand eine Idee?
Danke im vorraus
MfG
/e: So sieht das jetzt komplett bei mir aus:
Code:
<?php /** * Vote 4 Coins Script for topliste.***************** * * Coded by 'ChuckNorris * * Changelog: * 25.07.2014 Add time limit (stop flooding with vote links in skype) * * @copyright 'ChuckNorris 2014 All rights reserved */ $DELAY = 60 * 60 * 24;// Time Limit / f.e. 60 Sekunden * 60 Minuten * 24 Stunden = 24 Stunden (in Sekunden) $hpDB = 'account'; ?> <div style="margin-top: 70px;" class="box"> <div class="top"></div> <div class="middle"> <h3>Vote4Us</h3> <div class="big-line"></div> <? date_default_timezone_set('Europe/Berlin'); $VoteLink = "http://www.topliste.*****************/in/3757-yamora-net.html"; // Edit VoteLink $VotePage = $VoteLink . "?vuid=" . $_SESSION['user_id']; $VoteBonusCoins = 7; $CheckVoteLog_SQL = "SELECT UNIX_TIMESTAMP(`lastVote`) as lastVote FROM `" . $hpDB . "`.`v4c` WHERE `aid`='" . $vuid . "'"; $result = mysql_query($CheckVoteLog_SQL, $sqlHp); if(!empty($_SESSION["user_id"]) && mysql_num_rows($result) > 0 && mysql_result($result, 0, "lastVote") < time() - $DELAY) { ?> <p class="meldung"> Du hast bereits gevotet. Du kannst das nächste mal um <? echo date("G:i:s", mysql_result($result, 0, "lastVote") + $DELAY)?> voten. </p> <? } else if(!empty($_SESSION["user_id"])) { ?> <p class="meldung"> Pro Vote erhältst du <?php echo $VoteBonusCoins; ?> Vote-Coins! Missbrauch oder Bugusing wird mit<br> einem Bann von allen Account's bestraft!<br /> <b>Nachdem du gevotet hast kann es bis zu 2 Minuten dauern bis du deine Coins erhälst!</b> </p> <br> <p>Um voten zu können, klicke auf dem folgenden Link: <a href="<?php echo $VotePage; ?>"><font color="red">Vote!</font></a></p> <? } else { ?> <p><font color="red">ACHTUNG:</font> Du bekommst nur Vote-Coins, wenn du auch eingeloggt bist!<br> <a href="<?php echo $VoteLink;?>"><img style="border: 0px;" src="http://www.topliste.*****************/buttons/vote_8_0.png"/></a></p> <?php } ?> </div> <div class="bottom"></div> </div>
Code:
<?php /** * Vote 4 Coins Script for topliste.***************** * * Coded by 'ChuckNorris * * Changelog: * 25.07.2014 Add time limit (stop flooding with vote links in skype) * * @copyright 'ChuckNorris 2014 All rights reserved */ //******************** CONFIGURATION AREA ********************// $DELAY = 60 * 60 * 24;// Time Limit / f.e. 60 Sekunden * 60 Minuten * 24 Stunden = 24 Stunden (in Sekunden) $ID='HIERMEINEID'; // Enter side id here $API_KEY='HIERMEINKEY'; // Enter api key here $VoteCoins='7'; // Enter coins to get here $sqlServ = mysql_connect("neinein", "root", "nönönö"); $hpDB = 'account'; //****************** END CONFIGURATION AREA *******************// //***************** DO NOT CHANGE CODE HERE *******************// $REQUEST='votes'; $topl_curl=curl_init(); curl_setopt($topl_curl, CURLOPT_URL, 'http://www.topliste.*****************/api?id=' . urlencode($ID) . '&request=' . urlencode($REQUEST) . '&vuid=9999'); curl_setopt($topl_curl, CURLOPT_HEADER, 0); curl_setopt($topl_curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($topl_curl, CURLOPT_HTTPHEADER, array('X_APIKEY: ' . $API_KEY)); $topl_data=curl_exec($topl_curl); $topl_info=curl_getinfo($topl_curl); if (!curl_errno($topl_curl)) { if ($topl_info['http_code'] == 200) { $Data=json_decode($topl_data, true); foreach($Data as $vuid) { $CheckVoteLog_SQL = "SELECT UNIX_TIMESTAMP(`lastVote`) as lastVote FROM `" . $hpDB . "`.`v4c` WHERE `aid`='" . $vuid . "'"; $result = mysql_query($CheckVoteLog_SQL, $sqlServ); echo mysql_error(); $lastVoteTime = 0; if(mysql_num_rows($result) == 0) { $AddVoteLog_SQL = "INSERT INTO `" . $hpDB . "`.`v4c`(`aid`, `lastVote`) VALUES('" . $vuid . "', NOW())"; mysql_query($AddVoteLog_SQL); } else { $UpdateVoteLog_SQL = "UPDATE `" . $hpDB . "`.`v4c` SET `lastVote`=NOW() WHERE `aid`='" . $vuid . "'"; mysql_query($UpdateVoteLog_SQL); $lastVoteTime = mysql_result($result, 0, "lastVote"); } if($lastVoteTime < time() - $DELAY) { $PlayerNewCoins_SQL = "UPDATE account.account SET coins = coins + ".$VoteCoins." WHERE id = '".$vuid."'"; mysql_query($PlayerNewCoins_SQL, $sqlServ); } } } } else { echo 'Curl error: ' . curl_error($topl_curl); } curl_close($topl_curl); ?>