Voting

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 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

      PHP Source Code

      1. <?php
      2. class ShowVotePage extends AbstractGamePage
      3. {
      4. public static $requireModule = 0;
      5. function __construct()
      6. {
      7. parent::__construct();
      8. }
      9. function show()
      10. {
      11. global $USER, $PLANET, $LNG;
      12. $db = Database::get();
      13. $timp = $USER['onlinetime'] + 30*60;
      14. if($_POST){
      15. if($_POST['get'] == 1){
      16. if($timp > TIMESTAMP){
      17. $this->printMessage($LNG['vo_colected'], array("?page=vote", 2));
      18. die();
      19. }elseif(($_POST["captcha"] == $_SESSION["security_code"]) &&
      20. (!empty($_POST["captcha"]) && !empty($_SESSION["security_code"]))){
      21. $USER['darkmatter'] += 500;
      22. $this->printMessage(sprintf('Account succesfully updated with 500 DarkMatter!'), "game.php?page=vote", 2);
      23. die();
      24. }else{
      25. $this->printMessage(sprintf('Captcha error'), "game.php?page=vote", 2);
      26. die();
      27. }
      28. }
      29. }elseif(!empty($_GET['i'])){
      30. $vote_id = (int)$_GET['i'];
      31. $cautare = $db->selectSingle("SELECT * FROM `uni1_votesystem` where `id` = `".$vote_id."`;");
      32. if(mysqli_num_rows($cautare) == 0){
      33. $this->printMessage(sprintf('Dont try anything , wont work'), "game.php?page=vote", 2);
      34. die();
      35. }
      36. $cautare = mysqli_fetch_assoc($cautare);
      37. $find_vote = $db->selectSingle("SELECT * FROM `uni1_votesystem_log` where `user_id` = `".$USER['id']."` AND `vote_system_id` = `".$vote_id."`;");
      38. if(mysqli_num_rows($find_vote)>0){
      39. $find = mysqli_fetch_assoc($find_vote);
      40. if(TIMESTAMP < ($find['time']+12*60*60)){
      41. $this->printMessage($LNG['vo_colected'], array("?page=vote", 2));
      42. die();
      43. }else{
      44. $USER['darkmatter'] += 500;
      45. $db->query("UPDATE `uni1_votesystem_log` set `time` = `".TIMESTAMP."` where `user_id` = `".$USER['id']."` AND `vote_system_id` = `".$vote_id."`;");
      46. header("Location: ".$cautare['link']);
      47. }
      48. }else{
      49. $USER['darkmatter'] += 500;
      50. $db->query("INSERT INTO 'uni1_votesystem_log' VALUES (`".$USER['id']."`, `".TIMESTAMP."`, `".$vote_id."`)");
      51. header("Location: ".$cautare['link']);
      52. }
      53. }
      54. $captcha =0;
      55. if(!empty($USER['onlinetime']) && ($timp < TIMESTAMP)){
      56. $x = "<input type='submit' value='Collect'>";
      57. $y = "<font color='lime'>00:00</font>";
      58. $captcha = 1;
      59. }elseif(empty($USER['onlinetime'])){
      60. $x = "<input type='submit' value='Collect'>";
      61. $y = "<font color='lime'>00:00</font>";
      62. $captcha = 1;
      63. }else{
      64. $secunde = ($USER['onlinetime']+30*60)-TIMESTAMP;
      65. $y = "<font color='red'><span class=countdown2 secs=".$secunde."></span></font>";
      66. $x = "<input type='submit' value='Collect' disabled>";
      67. }
      68. $find_vote = $db->query("SELECT * FROM `uni1_votesystem`;");
      69. $votes = array();
      70. while($vote = mysqli_fetch_assoc($find_vote)){
      71. $find = $db->query("SELECT * FROM `uni1_votesystem_log` where `user_id` = ".$USER['id']." AND `vote_system_id` = ".$vote['id'].";");
      72. $votes[$vote['id']]= array();
      73. $votes[$vote['id']]['pic'] = $vote['image'];
      74. if(num_rows($find)>0){
      75. $find = fetch_assoc($find);
      76. if(TIMESTAMP < ($find['time']+12*60*60)){
      77. $secunde = $find['time']+12*60*60 - TIMESTAMP;
      78. $votes[$vote['id']]['link'] = '<font color=\'red\'><span class=countdown2 secs='.$secunde.'></span></font>';
      79. }else{
      80. $votes[$vote['id']]['link'] = '<font color=lime><a href=game.php?page=vote&i='.$vote['id'].' target=\"_blank\">Vote</a></font>';
      81. }
      82. }else{
      83. $votes[$vote['id']]['link'] = '<font color=lime><a href=game.php?page=vote&i='.$vote['id'].' target=\"_blank\">Vote</a></font>';
      84. }
      85. };
      86. $this->tplObj->loadscript("jquery.countdown.js");
      87. $this->tplObj->assign_vars(array(
      88. 'x' => $x,
      89. 'y' => $y,
      90. 'captcha' => $captcha,
      91. 'voturile' => $votes,
      92. ));
      93. $this->display('page.vote.default.tpl');
      94. }
      95. }
      96. ?>
      Display All
    • Thank you for your Fast Answer
      But It dont Work
      ;(

      Display Spoiler

      Message: Invalid argument supplied for foreach()
      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 /includes/pages/game/ShowVotePage.class.php(89): errorHandler(2, 'Invalid argumen...', '/...', 89, Array)
      #1 /game.php(57): ShowVotePage->show()
      #2 {main}
    • mimikri wrote:

      whats in uni1_votesystem?
      These are the SQL database.

      SQL-Query

      1. CREATE TABLE `uni1_votesystem` (
      2. `id` bigint(20) NOT NULL,
      3. `link` text NOT NULL,
      4. `prize` int(11) NOT NULL,
      5. `image` text NOT NULL,
      6. `time` int(11) DEFAULT '12'
      7. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
      8. --
      9. -- Daten für Tabelle `uni1_votesystem`
      10. --
      11. INSERT INTO `uni1_votesystem` (`id`, `link`, `prize`, `image`, `time`) VALUES
      12. (1, 'http://rivaltoplist.com?in=2285', 500, 'http://www.rivaltoplist.com/vote.jpg', 2),
      13. -- --------------------------------------------------------
      14. --
      15. -- Tabellenstruktur für Tabelle `uni1_votesystem_log`
      16. --
      17. CREATE TABLE `uni1_votesystem_log` (
      18. `user_id` int(11) NOT NULL,
      19. `time` int(11) NOT NULL DEFAULT '0',
      20. `vote_system_id` int(11) NOT NULL DEFAULT '0'
      21. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
      22. --
      23. -- Daten für Tabelle `uni1_votesystem_log`
      24. --
      25. INSERT INTO `uni1_votesystem_log` (`user_id`, `time`, `vote_system_id`) VALUES
      26. (37, 1424625175, 1),
      27. (37, 1424625182, 2),
      28. (28, 1432141144, 1),
      29. (37, 1424625218, 3),
      30. (28, 1432141145, 2),
      31. (28, 1432141146, 3),
      32. (57, 1428887207, 1),
      33. (57, 1428887210, 2),
      34. (57, 1428887212, 3),
      35. (64, 1420378671, 1),
      36. (64, 1420378675, 2),
      37. (64, 1420378678, 3),
      38. (32, 1428662006, 1),
      39. (32, 1428662010, 2),
      40. (32, 1428662013, 3),
      41. (72, 1419596608, 1),
      42. (72, 1419596638, 2),
      43. (72, 1419596704, 3),
      44. (66, 1419678357, 1),
      45. (66, 1419678366, 2),
      46. (66, 1419678368, 3),
      47. (76, 1420141852, 1),
      48. (76, 1420141930, 2),
      49. (76, 1420141987, 3),
      50. (87, 1422390330, 1),
      51. (87, 1422390345, 2),
      52. (87, 1422390360, 3),
      53. (177, 1437225184, 3);
      54. --
      55. -- Indizes der exportierten Tabellen
      56. --
      57. --
      58. -- Indizes für die Tabelle `uni1_votesystem`
      59. --
      60. ALTER TABLE `uni1_votesystem`
      61. ADD UNIQUE KEY `id` (`id`);
      62. --
      63. -- AUTO_INCREMENT für exportierte Tabellen
      64. --
      65. --
      66. -- AUTO_INCREMENT für Tabelle `uni1_votesystem`
      67. --
      68. ALTER TABLE `uni1_votesystem`
      69. MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
      Display All


      Danter14 wrote:

      Mimikri there are a lot of things in the code that do not go I'm trying to coded
      Thank You :D
    • Sadly it still does not work

      Display Spoiler

      Message: Undefined variable: vote_id
      File: /includes/pages/game/ShowVotePage.class.php
      Line: 107
      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 /includes/pages/game/ShowVotePage.class.php(107): errorHandler(8, 'Undefined varia...', '/...', 107, Array)
      #1 /game.php(57): ShowVotePage->show()
      #2 {main}
    • of nothing for information I will make a big part of the mods available on version 1.7.3 but all personal mods ask me in MP (will not be free)