Hi,
I have fund a Old Voting Mod on my Hard Drive.
But he doesn't work under 2.0.
Can somebody Help me?
Display Spoiler
Message: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given
File: /includes/pages/game/ShowVotePage.class.php
Line: 89
URL: http:///space/game.php?page=vote
PHP-Version: 7.0.30-1+ubuntu14.04.1+deb.sury.org+1
PHP-API: apache2handler
2Moons Version: 2.0.git
Debug Backtrace:
#0 [internal function]: errorHandler(2, 'mysqli_fetch_as...', '/...', 89, Array)
#1 /includes/pages/game/ShowVotePage.class.php(89): mysqli_fetch_assoc(NULL)
#2 /game.php(57): ShowVotePage->show()
#3 {main}
Display Spoiler
Display All
I have fund a Old Voting Mod on my Hard Drive.
But he doesn't work under 2.0.
Can somebody Help me?
Message: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given
File: /includes/pages/game/ShowVotePage.class.php
Line: 89
URL: http:///space/game.php?page=vote
PHP-Version: 7.0.30-1+ubuntu14.04.1+deb.sury.org+1
PHP-API: apache2handler
2Moons Version: 2.0.git
Debug Backtrace:
#0 [internal function]: errorHandler(2, 'mysqli_fetch_as...', '/...', 89, Array)
#1 /includes/pages/game/ShowVotePage.class.php(89): mysqli_fetch_assoc(NULL)
#2 /game.php(57): ShowVotePage->show()
#3 {main}
PHP Source Code
- <?php
- class ShowVotePage extends AbstractGamePage
- {
- public static $requireModule = 0;
- function __construct()
- {
- parent::__construct();
- }
- function show()
- {
- global $USER, $PLANET, $LNG;
- $db = Database::get();
- $timp = $USER['onlinetime'] + 30*60;
- if($_POST){
- if($_POST['get'] == 1){
- if($timp > TIMESTAMP){
- $this->printMessage($LNG['vo_colected'], array("?page=vote", 2));
- die();
- }elseif(($_POST["captcha"] == $_SESSION["security_code"]) &&
- (!empty($_POST["captcha"]) && !empty($_SESSION["security_code"]))){
- $USER['darkmatter'] += 500;
- $this->printMessage(sprintf('Account succesfully updated with 500 DarkMatter!'), "game.php?page=vote", 2);
- die();
- }else{
- $this->printMessage(sprintf('Captcha error'), "game.php?page=vote", 2);
- die();
- }
- }
- }elseif(!empty($_GET['i'])){
- $vote_id = (int)$_GET['i'];
- $cautare = $db->selectSingle("SELECT * FROM `uni1_votesystem` where `id` = `".$vote_id."`;");
- if(mysqli_num_rows($cautare) == 0){
- $this->printMessage(sprintf('Dont try anything , wont work'), "game.php?page=vote", 2);
- die();
- }
- $cautare = mysqli_fetch_assoc($cautare);
- $find_vote = $db->selectSingle("SELECT * FROM `uni1_votesystem_log` where `user_id` = `".$USER['id']."` AND `vote_system_id` = `".$vote_id."`;");
- if(mysqli_num_rows($find_vote)>0){
- $find = mysqli_fetch_assoc($find_vote);
- if(TIMESTAMP < ($find['time']+12*60*60)){
- $this->printMessage($LNG['vo_colected'], array("?page=vote", 2));
- die();
- }else{
- $USER['darkmatter'] += 500;
- $db->query("UPDATE `uni1_votesystem_log` set `time` = `".TIMESTAMP."` where `user_id` = `".$USER['id']."` AND `vote_system_id` = `".$vote_id."`;");
- header("Location: ".$cautare['link']);
- }
- }else{
- $USER['darkmatter'] += 500;
- $db->query("INSERT INTO 'uni1_votesystem_log' VALUES (`".$USER['id']."`, `".TIMESTAMP."`, `".$vote_id."`)");
- header("Location: ".$cautare['link']);
- }
- }
- $captcha =0;
- if(!empty($USER['onlinetime']) && ($timp < TIMESTAMP)){
- $x = "<input type='submit' value='Collect'>";
- $y = "<font color='lime'>00:00</font>";
- $captcha = 1;
- }elseif(empty($USER['onlinetime'])){
- $x = "<input type='submit' value='Collect'>";
- $y = "<font color='lime'>00:00</font>";
- $captcha = 1;
- }else{
- $secunde = ($USER['onlinetime']+30*60)-TIMESTAMP;
- $y = "<font color='red'><span class=countdown2 secs=".$secunde."></span></font>";
- $x = "<input type='submit' value='Collect' disabled>";
- }
- $find_vote = $db->query("SELECT * FROM `uni1_votesystem`;");
- $votes = array();
- while($vote = mysqli_fetch_assoc($find_vote)){
- $find = $db->query("SELECT * FROM `uni1_votesystem_log` where `user_id` = ".$USER['id']." AND `vote_system_id` = ".$vote['id'].";");
- $votes[$vote['id']]= array();
- $votes[$vote['id']]['pic'] = $vote['image'];
- if(num_rows($find)>0){
- $find = fetch_assoc($find);
- if(TIMESTAMP < ($find['time']+12*60*60)){
- $secunde = $find['time']+12*60*60 - TIMESTAMP;
- $votes[$vote['id']]['link'] = '<font color=\'red\'><span class=countdown2 secs='.$secunde.'></span></font>';
- }else{
- $votes[$vote['id']]['link'] = '<font color=lime><a href=game.php?page=vote&i='.$vote['id'].' target=\"_blank\">Vote</a></font>';
- }
- }else{
- $votes[$vote['id']]['link'] = '<font color=lime><a href=game.php?page=vote&i='.$vote['id'].' target=\"_blank\">Vote</a></font>';
- }
- };
- $this->tplObj->loadscript("jquery.countdown.js");
- $this->tplObj->assign_vars(array(
- 'x' => $x,
- 'y' => $y,
- 'captcha' => $captcha,
- 'voturile' => $votes,
- ));
- $this->display('page.vote.default.tpl');
- }
- }
- ?>