PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#26 2008-03-04 17:34:00

FSX
Member
Registered: 2006-09-14
Posts: 593
Website

Re: PunArcade portal

I had it installed on 1.2.16 and update my forum to 1.2.17 and it still works proporly.

Offline

 

#27 2008-03-04 22:51:18

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: PunArcade portal

lol i'm doomed XD
i have installed it / uninstalled it / installed it ....
still does not work lol
even got liquidat0r to send me the files he uses.


Cant find something you want? try searching
Also try the wiki

Offline

 

#28 2008-03-05 17:11:04

FSX
Member
Registered: 2006-09-14
Posts: 593
Website

Re: PunArcade portal

Post your newscore.php and the full error here, maybe I can help you. I have had troubles with my newscore.php too, but that was with 1.2.16.

Offline

 

#29 2008-03-05 20:19:01

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: PunArcade portal

i dont have it installed again now lol
but it was a clean install from the download link on page 1.


Cant find something you want? try searching
Also try the wiki

Offline

 

#30 2008-05-06 23:08:09

Scripter
Member
Registered: 2006-06-11
Posts: 171
Website

Re: PunArcade portal

liquidat0r wrote:

I modified my Arcade page slightly, I can't remember exactly what it looks like, or whether there are any errors as I can't access my site ATM. But anyway, here you go:

Code:

<?php


session_name("arcade_games");
session_start();

// Session first run?
if (!isset($_SESSION['firsttime']))
{
    // Set defaults
    $_SESSION['firsttime'] = true;
    $_SESSION['cat']=0;
    $_SESSION['nump']=25;
    $_SESSION['search']='';
    $_SESSION['rsearch']='game_name';
    $_SESSION['page']=0;
    $_SESSION['sorto']='DESC';
    $_SESSION['sortby']='game_id';
    //$sqlquery = '';
}
else
{
    // no first run, use post or request
    if (isset($_POST['nump'])) $_SESSION['nump']=$_POST['nump'];
    if (isset($_POST['cat'])) $_SESSION['cat']=$_POST['cat'];
    if (isset($_POST['search'])) $_SESSION['search']=$_POST['search'];
    if (isset($_POST['rsearch'])) $_SESSION['rsearch']=$_POST['rsearch'];
    if (isset($_REQUEST['page'])) $_SESSION['page']=$_REQUEST['page'];
    if (isset($_POST['sorto'])) $_SESSION['sorto']=$_POST['sorto'];
    if (isset($_POST['sortby'])) $_SESSION['sortby']=$_POST['sortby'];
}

// Define local vars
$s_nump = $_SESSION['nump'];
$s_cat = $_SESSION['cat'];
$s_search = $_SESSION['search'];
$s_rsearch = $_SESSION['rsearch'];
$s_page = $_SESSION['page'];
$s_sorto = $_SESSION['sorto'];
$s_sortby = $_SESSION['sortby'];
$sqlquery = '';

if (!defined('PUN_ROOT')) define('PUN_ROOT','./');
require PUN_ROOT.'include/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/arcade.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Arcade Games';

define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

if (!function_exists('generate_config_cache'))
    require PUN_ROOT.'include/cache.php';
    
if ($pun_config['arcade_live'] == '0')
    message($lang_arcade['arcade disabled']);
    
    
if (!$pun_user['is_guest'])
{
    // Fetch total game count
    $result = $db->query('SELECT COUNT(game_id) FROM '.$db->prefix.'arcade_games') or error('Unable to fetch total game count', __FILE__, __LINE__, $db->error());
    $num_games = $db->result($result);

    ?>
<style type="text/css">    
#leftc {width: 180px;
        float: left;}
    #rightc {width: 180px;
        float: right;}
    #mainc {margin-left: 190px;
         margin-right: 190px;}
</style>
<link rel="stylesheet" type="text/css" href="/forum/style/KNTL.css"/>
<link rel="stylesheet" type="text/css" href="/forum/style/imports/KNTL_cs.css"/>
<? // Arcade Statistic Block ?>
<div id="leftc">
  <div class="block">
    <h2><? echo ''.$lang_arcade['new_games'].'' ?></h2>
    <div class="box">
      <div class="inbox">
        <fieldset>
        <legend>Newest Additions</legend>
        <div class="infldset">
          <ul>
            <? // Get latest games
            $result2 = $db->query('SELECT game_id, game_name, game_image FROM '.$db->prefix.'arcade_games ORDER BY game_id DESC LIMIT '.$pun_config['arcade_numnew'].'') or error('Unable to get latest games', __FILE__, __LINE__, $db->error());
            $i = 1;
            while($line = $db->fetch_assoc($result2))
            {
                echo '<li><img align="top" src="games/images/_'.$line['game_image'].'" /></a>&nbsp;<a href="arcade_play.php?id='.$line['game_id'].'">'.$line['game_name'].'</a></li>';
                $i++;
            }
             ?>
          </ul>
        </div>
        </fieldset>
      </div>
    </div>
  </div>
  <div class="block">
    <h2><?php echo $pun_config['o_board_title']; ?> Arcade</h2>
    <div class="box">
      <div class="inbox">
        <ul>
          <li>Total Games: <? echo ''.$num_games.'' ?></li>
        </ul>
      </div>
    </div>
  </div>
</div>
<div id="rightc">
  <div class="block">
    <h2><? echo ''.$lang_arcade['most_played'].'' ?></h2>
    <div class="box">
      <div class="inbox">
        <fieldset>
        <legend><? echo ''.$lang_arcade['most_played'].' Games' ?></legend>
        <div class="infldset">
          <? // Find most played games
            $result3 = $db->query('SELECT game_id, game_name, game_played, game_image FROM '.$db->prefix.'arcade_games ORDER BY game_played DESC LIMIT '.$pun_config['arcade_mostplayed'].'') or error('Unable to get most played games', __FILE__, __LINE__, $db->error());
            $i = 1;
            while($line = $db->fetch_assoc($result3))
            {
                // Display most played games
echo '<span><a href="arcade_play.php?id='.$line['game_id'].'" title="'.$lang_arcade['played'].' '.$line['game_played'].'"><img align="top" src="games/images/_'.$line['game_image'].'" /></a>&nbsp;<a href="arcade_play.php?id='.$line['game_id'].'" title="'.$lang_arcade['played'].' '.$line['game_played'].'">'.$line['game_name'].' ('.$line['game_played'].')</a><p></span>';                $i++;
            } ?>
        </div>
        </fieldset>
      </div>
    </div>
  </div>
  <? // Get random game and statistic
            $result6 = $db->query('SELECT game_id, game_name,game_image FROM '.$db->prefix.'arcade_games GROUP BY game_name order by RAND() LIMIT 1') or error('Unable to fetch total game count', __FILE__, __LINE__, $db->error());
            $randg = $db->fetch_assoc($result6); ?>
  <div class="block">
    <h2><? echo $lang_arcade['randomg'] ?></h2>
    <div class="box">
      <div class="inbox">
        <fieldset>
        <legend><? echo $lang_arcade['randomg'] ?></legend>
        <div class="infldset">
          <p align="center"><a href="arcade_play.php?id=<? echo $randg['game_id'] ?>" title="Play <? echo $randg['game_name'] ?>!"><img src="/games/images/<? echo $randg['game_image'] ?>" /></p>
        </div>
        </fieldset>
      </div>
    </div>
  </div>
</div>
<? // King of Highscore images ?>
<div id="mainc">
  <div class="block">
    <h2><? echo 'Arcade Games ('.$lang_arcade['number games'].' '.$num_games.')' ?></h2>
    <div class="box">
      <div class="inbox">
        <fieldset>
        <legend> <? echo ''.$lang_arcade['highscore_champs'].'' ?> </legend>
        <div class="infldset">
          <table cellspacing="0" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; ">
            <tr style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; ">
              <td class="alt2" align="center" nowrap="nowrap" valign="middle" width="33%" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><b><img src="/forum/img/arcade/king1.gif" alt="1" title=""></b></td>
              <td class="alt2" align="center" nowrap="nowrap" valign="middle" width="33%" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><b><img src="/forum/img/arcade/king2.gif" alt="2" title=""></b></td>
              <td class="alt2" align="center" nowrap="nowrap" valign="middle" width="33%" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><b><img src="/forum/img/arcade/king3.gif" alt="3" title=""></b></td>
            </tr>
            <? // Count all Highscores per user, display the king of the highscores
            $sql = 'SELECT id,username, COUNT(*) AS count_top FROM '.$db->prefix.'arcade_ranking INNER JOIN '.$db->prefix.'users ON ('.$db->prefix.'users.id = '.$db->prefix.'arcade_ranking.rank_player) WHERE '.$db->prefix.'arcade_ranking.rank_topscore = 1 GROUP BY '.$db->prefix.'arcade_ranking.rank_player ORDER BY count_top DESC LIMIT 3';
            $query = $db->query($sql) or error("Impossible to collect highscores per user.", __FILE__, __LINE__, $db->error());
            $i = 1;
            while($line = $db->fetch_assoc($query))
            {
                echo '<td width="33%" align="center" nowrap="nowrap" valign="middle" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><strong><span><a href="arcade_userstats.php?id='.$line['id'].'" title="'.$lang_arcade['view_stats'].'">'.$line['username'].'</a></strong></span><br/>'.$lang_arcade['with'].' <b>'.$line['count_top'].'</b> '.$lang_arcade['highscores'].'</td>';
                $i++;
            } ?>
          </table>
        </div>
        </fieldset>
      </div>
    </div>
  </div>
  <div class="blocktable">
    <h2>Latest Scores</h2>
    <div class="box">
      <div class="inbox">
        <? // Find the latest Highscores    
            $sql = 'SELECT game_name, game_id, rank_topscore, username, id, rank_date, rank_score FROM '.$db->prefix.'arcade_ranking, '.$db->prefix.'arcade_games, '.$db->prefix.'users WHERE rank_topscore = 1 AND rank_game = game_filename AND '.$db->prefix.'users.id = rank_player GROUP BY game_name ORDER BY rank_date DESC LIMIT '.$pun_config['arcade_numchamps'].'';
            $query = $db->query($sql) or error("Impossible to select the latest highscores.", __FILE__, __LINE__, $db->error());
            $i = 1;
            while($line = $db->fetch_assoc($query))
            {
                // Display the latest Highscores    
                echo '<table cellspacing="0"><td align="left" width="75%"><p><a href="arcade_userstats.php?id='.$line['id'].'" title="'.$lang_arcade['view_stats'].'">'.$line['username'].'</a> '.$lang_arcade['is_the_new'].' <a href="arcade_play.php?id='.$line['game_id'].'">'.$line['game_name'].'</a> '.$lang_arcade['champion'].'.</p></td><td align="right"><p> ('.format_time($line['rank_date']).')</p></td></table>';
                $i++;
            } ?>
      </div>
    </div>
  </div>
</div>
<? // Define search query
    if (strlen($s_search)>0) $sqlquery .= " WHERE {$s_rsearch} LIKE '%{$s_search}%'";
    // Did we use a category or the search box?
    if ($s_cat>0)
    {
        if (strlen($s_search)>0)
        {
            $sqlquery .= " AND game_cat = {$s_cat} ORDER BY game_name {$s_sorto}";
        }
        else
        {
            $sqlquery .= " WHERE game_cat = {$s_cat} ORDER BY game_name {$s_sorto}";
        }
    }
    else
    {
        $sqlquery .= " ORDER BY {$s_sortby} {$s_sorto}";
    } ?>
<? // Show/hide Filter Block ?>
<script language="javascript">
    <!--
        var state = 'none';
        function showhide(layer_ref) 
        {
            if (state == 'block') 
            {
                state = 'none';
            }
            else 
            {
                state = 'block';
            }
        if (document.all) 
            { //IS IE 4 or 5 (or 6 beta)
                eval( "document.all." + layer_ref + ".style.display = state");
            }
        if (document.layers) 
            { //IS NETSCAPE 4 or below
                document.layers[layer_ref].display = state;
            }
        if (document.getElementById &&!document.all) 
            {
                hza = document.getElementById(layer_ref);
                hza.style.display = state;
            }
        }
    //-->
    </script>
<? // Filter Block. ?>
<div style="padding: 5px 5px 5px 5px; border:none;" class="box">
  <fieldset>
  <legend><a href="javascript:void(0)" onclick="showhide('div3');"><? echo $lang_arcade['filter'] ?></a></legend>
  <div class="infldset" id="div3" style="display:none;">
    <form method="post" action="<? echo $_SERVER['PHP_SELF'] ?>" enctype="multipart/form-data">
      <table cellspacing="0" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; ">
        <tr>
          <td valign="top" align="left" width="21%" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><? echo $lang_arcade['numgames'] ?>
            <select id="nump" name="nump">
              <option value="10" <? if ($s_nump == 10) echo ' selected="selected"' ?>>10</option>
              <option value="25" <? if ($s_nump == 25) echo ' selected="selected"' ?>>25</option>
              <option value="50" <? if ($s_nump == 50) echo ' selected="selected"' ?>>50</option>
              <option value="100" <? if ($s_nump == 100) echo ' selected="selected"' ?>>100</option>
            </select>
            <input type="radio" name="sorto" value="ASC" <? if ($s_sorto == 'ASC') { echo ' checked'; } ?> />
            &nbsp;<? echo $lang_arcade['asc'] ?>&nbsp;
            <input type="radio" name="sorto" value="DESC" <? if ($s_sorto == 'DESC') { echo ' checked'; } ?> />
            &nbsp;<? echo $lang_arcade['desc'] ?> </td>
          <td valign="top" align="left" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><? echo $lang_arcade['sortby'] ?>
            <select id="sortby" name="sortby">
              <option value="game_name" <? if ($s_sortby == 'game_name') echo ' selected="selected"' ?>><? echo $lang_arcade['name'] ?></option>
              <option value="game_id" <? if ($s_sortby == 'game_id') echo ' selected="selected"' ?>><? echo $lang_arcade['date'] ?></option>
            </select>
          </td>
          <td valign="top" align="left" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><? echo $lang_arcade['category'] ?>
            <select id="cat" name="cat">
              <option value="0" <? if ($s_cat == 0) echo ' selected="selected"' ?>><? echo $lang_arcade['all cat'] ?></option>
              <option value="1" <? if ($s_cat == 1) echo ' selected="selected"' ?>><? echo $lang_arcade['cat1'] ?></option>
              <option value="2" <? if ($s_cat == 2) echo ' selected="selected"' ?>><? echo $lang_arcade['cat2'] ?></option>
              <option value="3" <? if ($s_cat == 3) echo ' selected="selected"' ?>><? echo $lang_arcade['cat3'] ?></option>
              <option value="4" <? if ($s_cat == 4) echo ' selected="selected"' ?>><? echo $lang_arcade['cat4'] ?></option>
              <option value="5" <? if ($s_cat == 5) echo ' selected="selected"' ?>><? echo $lang_arcade['cat5'] ?></option>
              <option value="6" <? if ($s_cat == 6) echo ' selected="selected"' ?>><? echo $lang_arcade['cat6'] ?></option>
              <option value="7" <? if ($s_cat == 7) echo ' selected="selected"' ?>><? echo $lang_arcade['cat7'] ?></option>
              <option value="8" <? if ($s_cat == 8) echo ' selected="selected"' ?>><? echo $lang_arcade['cat8'] ?></option>
              <option value="9" <? if ($s_cat == 9) echo ' selected="selected"' ?>><? echo $lang_arcade['cat9'] ?></option>
            </select>
          </td>
          <td valign="top" align="left" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><? echo $lang_arcade['search'] ?>
            <input type="text" id="search" name="search" size="20" maxlength="100" value="<? echo pun_htmlspecialchars($s_search); ?>" />
            &nbsp;&nbsp;
            <input type="radio" name="rsearch" value="game_name" <? if ($s_rsearch == 'game_name') { echo ' checked'; } ?> />
            &nbsp;<? echo $lang_arcade['gname'] ?>&nbsp;
            <input type="radio" name="rsearch" value="game_desc" <? if ($s_rsearch == 'game_desc') { echo ' checked'; } ?> />
            &nbsp;<? echo $lang_arcade['gdesc'] ?> </td>
        </tr>
        <tr>
          <td valign="bottom" colspan="5" style="padding: 0px 0px 0px 0px; margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border:none; "><input type="hidden" name="page" value="0" />
            <br />
            <input type="submit" name="filter" value="<? echo $lang_arcade['start'] ?>" />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input name="filter" type="submit" onClick="nump.value='25';cat.value='0';search.value='';rsearch.value='game_name';elements[5].checked = true;elements[2].checked = true;sortby.value='game_id';window.location='<? echo $_SERVER['PHP_SELF'] ?>';" value="<? echo $lang_arcade['reset'] ?>" />
          </td>
        </tr>
      </table>
    </form>
  </div>
  </fieldset>
</div>
<? // Fetch game count and generate pages, after using filter
    $result = $db->query('SELECT COUNT(game_id) FROM '.$db->prefix.'arcade_games '.$sqlquery) or error('Unable to fetch filter count', __FILE__, __LINE__, $db->error());
    $num_games2 = $db->result($result);
    $currec = $s_page * $s_nump;
    $kolvop = ceil($num_games2 / $s_nump);
    $cp = ($kolvop == 0? 1 : $kolvop);
    $nump = $s_nump;

    // Generate page links
     if ($cp>1)
        {
            echo '<p>', $lang_common['Pages'],':';
            for ($i=1;$i<=$cp;$i++)
            if (($i-1)==$s_page) echo " $i ";
            else echo ' <a href="'.$_SERVER['PHP_SELF'].'?page='.($i-1).'">'.$i.'</a> ';
        }
        echo '<p>';
        

    // Output Games, highscores, description ?>
<div class="blockform">
  <h2><? echo ''.$lang_arcade['Arcade Games'].''; ?></h2>
  <div class="box">
    <div class="inbox">
      <table cellspacing="0">
        <thead>
          <tr>
            <th class="tc2" scope="col" width="25%" nowrap="nowrap"><? echo $lang_arcade['Games'] ?></th>
            <th class="tc2" scope="col" width="25%" nowrap="nowrap"><? echo $lang_arcade['highscores'] ?></th>
            <th class="tc3" scope="col" width="25%" nowrap="nowrap"><? echo $lang_arcade['Your highscore'] ?></th>
            <th class="tcr" scope="col" width="25%" ><? echo $lang_arcade['How to play'] ?></th>
          </tr>
        </thead>
        <tbody>
          <? // Filter query
        $result = $db->query('SELECT * FROM '.$db->prefix.'arcade_games '.$sqlquery." LIMIT $currec,$nump") or error("Impossible to filter games", __FILE__, __LINE__, $db->error());
        while($line = $db->fetch_assoc($result))
        {
            // Find Top Highscore of each game        
            $sql2 = 'SELECT rank_player, rank_score, username, id FROM '.$db->prefix.'arcade_ranking, '.$db->prefix.'users WHERE rank_game = "'.$line['game_filename'].'" AND '.$db->prefix.'users.id = '.$db->prefix.'arcade_ranking.rank_player ORDER BY rank_score DESC LIMIT 1';
            $query = $db->query($sql2) or error("Impossible to find the topscore of each game", __FILE__, __LINE__, $db->error());
            $resultat = $db->fetch_assoc($query);
            if (($resultat['rank_score']) && ($pun_config['arcade_showtop'] > 0))
                $h_score = ''.$lang_arcade['Top highscore'].'<strong>'.$resultat['rank_score'].'</strong> '.$lang_arcade['by'].' <i><a href="profile.php?id='.$resultat['id'].'"> '.$resultat['username'].'</a></i><p> '.$lang_arcade['Your highscore'].': <strong>'.$resultat['rank_score'].'</strong><p>'.$lang_arcade['played'].' <strong>'.$line['game_played'].'</strong>';
            else
                $h_score = ' ';
                echo '<thead>
                    <tr>
                    <td class="tc1" scope="col" width="25%" ><table style="padding: 0px 0px 0px 0px; border:none; "><tr style="padding: 0px 0px 0px 0px; border:none; ">
                    <td style="padding: 0px 0px 0px 0px; border:none; " align="left" width="50"><a href="arcade_play.php?id='.$line['game_id'].'" title="'.$lang_arcade['Pic Click'].'"><img src="games/images/'.$line['game_image'].'" alt="'.$line['game_name'].'" /></a></td>
                    <td style="padding: 0px 0px 0px 0px; border:none; " align="left">'.$lang_arcade['Play'].': "<a href="arcade_play.php?id='.$line['game_id'].'" title="'.$lang_arcade['Pic Click'].'">'.$line['game_name'].'</a>"<p><p>
'.$lang_arcade['played'].' <strong>'.$line['game_played'].'</strong></td>
                    </tr>
                    </table></td>
                    <td class="tc2" scope="col" width="25%" nowrap="nowrap">';
                    if ($resultat['rank_score'] > 0) {
                        echo''.$lang_arcade['Top highscore'].'<strong>'.$resultat['rank_score'].'</strong><br />
<i> '.$lang_arcade['by'].' <strong><a href="arcade_userstats.php?id='.$resultat['id'].'" title="'.$lang_arcade['view_stats'].'">'.$resultat['username'].'</a></i></strong><p />
<a href="arcade_ranking.php?id='.$line['game_id'].'">'.$lang_arcade['View Highscore'].'</a>'; } else { echo ''.$lang_arcade['Top highscore'].'<strong> N/A'; } echo '</td>
                        <td class="tc2" scope="col" width="25%" nowrap="nowrap">';
                        // Find best score of user
                        $result21 = $db->query('SELECT rank_score, game_id, game_name, game_played FROM '.$db->prefix.'arcade_ranking, '.$db->prefix.'arcade_games WHERE rank_game = "'.$line['game_filename'].'" AND rank_player = "'.$pun_user['id'].'"') or error('Unable to fetch scores info', __FILE__, __LINE__, $db->error());

            // if(mysql_num_rows($result21) <= 0)
            // Fix for MySQL 4
            $resultatt = $db->fetch_assoc($result21);
            if($resultatt <= 0)
                { 
                    echo $lang_arcade['Not played yet'];
                }
            else
                {
                    $line21 = $db->fetch_assoc($result21);
                    echo $lang_arcade['Your highscore'],': '  ?>
        <strong>
        <?  echo $line21['rank_score']  ?>
        </strong>
        <? 
                }
            echo '</td>
            <td class="tc1" scope="col" width="25%" ><i>'.$line['game_desc'].'</i></td>
            </tr>
            </thead>';
        } ?>
        </tbody>
        
      </table>
    </div>
  </div>
</div>
<? // Generate page links
     if ($cp>1)
        {
            echo $lang_common['Pages'],':';
            for ($i=1;$i<=$cp;$i++)
            if (($i-1)==$s_page) echo " $i ";
            else echo ' <a href="'.$_SERVER['PHP_SELF'].'?page='.($i-1).'">'.$i.'</a> ';
        }
        echo '
<p>';
  
  require PUN_ROOT.'footer.php';
  }
  
  else
  message($lang_common['No permission']);

The search box is slightly off....

Offline

 

#31 2008-06-13 17:16:40

forumdesados
New member
Registered: 2008-03-09
Posts: 6

Re: PunArcade portal

Could anyone help me please, I have a major problem...

When i want to save a score, I've an error:

Parse error: syntax error, unexpected '}' in /home/forumdes/public_html/newscore.php on line 8

I've not changed anything in my newscore.php

Sorry for the bad english i use, i'm french :s

That is my newscore.php:

Code:

<?php
define('PUN_ROOT', './');require PUN_ROOT.'include/common.php';
if ($pun_user['g_id'] == PUN_GUEST)    error($lang_common['No permission']);
// Recover the game name and the score $game_name = $HTTP_POST_VARS['game_name'];// str_replace strips all spaces present in the score string$score = str_replace(" ", "", $HTTP_POST_VARS['score']);$topscore = 0;$now = time();// This is a fix for var "score" wich is send as "Score" and not as "score" like in game "Easter Egg Catch"    if(empty($score))    {        $score = $HTTP_POST_VARS['Score'];    }if(!empty($game_name) && !empty($score)){    // Find Topscore    $sql = 'SELECT rank_topscore, rank_score FROM '.$db->prefix.'arcade_ranking, '.$db->prefix.'users WHERE rank_player = '.$db->prefix.'users.id AND rank_game = "'.$game_name.'" ORDER BY rank_score DESC LIMIT 1';        $query = $db->query($sql) or error("Impossible to select topscore.", __FILE__, __LINE__, $db->error());    $line = $db->fetch_assoc($query);    if($line['rank_topscore'] = 1 && $line['rank_score'] < $score)    {        $sql = 'UPDATE '.$db->prefix.'arcade_ranking SET rank_topscore = '.$topscore.' WHERE rank_game = "'.$game_name.'"';        $query = $db->query($sql) or error("Impossible to update the topscore", __FILE__, __LINE__, $db->error());        $topscore = 1;    }    elseif($line['rank_topscore'] >= 0 && $line['rank_score'] <= $score)    {        $topscore = 1;            }    else    {        $topscore = 0;    }    $sql = 'SELECT * FROM '.$db->prefix.'arcade_ranking WHERE rank_player = '.$pun_user['id'].' AND rank_game = "'.$game_name.'"';    $query = $db->query($sql) or error("Impossible to select the user and game", __FILE__, __LINE__, $db->error());    if(mysql_num_rows($query) > 0)    {        $line = $db->fetch_assoc($query);        if($line['rank_score'] <= $score)        {        
            // Update new highscore            $sql = 'UPDATE '.$db->prefix.'arcade_ranking SET rank_score = '.$score.', rank_date = '.$now.' , rank_topscore = '.$topscore.' WHERE rank_player = '.$pun_user['id'].' AND rank_game = "'.$game_name.'"';            $query = $db->query($sql) or error("Impossible to update new highscore", __FILE__, __LINE__, $db->error());    
            $sql = 'SELECT game_id FROM '.$db->prefix.'arcade_games WHERE game_filename = "'.$game_name.'"';            $query = $db->query($sql) or error("Impossible to select the game", __FILE__, __LINE__, $db->error());            $gameid = $db->fetch_assoc($query);
            echo '<script type="text/javascript">window.location= "arcade_ranking.php?id='.$gameid['game_id'].'"</script>';
        }
        else
        {            // No new highscore            $sql = 'SELECT game_id FROM '.$db->prefix.'arcade_games WHERE game_filename = "'.$game_name.'"';            $query = $db->query($sql) or error("Impossible to select the game", __FILE__, __LINE__, $db->error());            $gameid = $db->fetch_assoc($query);            echo '<script type="text/javascript">window.location= "arcade_play.php?id='.$gameid['game_id'].'"</script>';
        }    }
    else
    {
        // Is there a score?        $sql = 'SELECT rank_score, rank_topscore FROM '.$db->prefix.'arcade_ranking WHERE rank_game = "'.$game_name.'" ORDER BY rank_score DESC, rank_topscore DESC';        $query = $db->query($sql) or error("Impossible to select the topscore", __FILE__, __LINE__, $db->error());        $line = $db->fetch_assoc($query);        if($line['rank_score'] <= 0 && $line['rank_topscore'] <= 0)        {            $topscore = 1;        }        // Add new Highscore        $sql = 'INSERT INTO '.$db->prefix.'arcade_ranking (rank_game, rank_player, rank_score, rank_topscore, rank_date) VALUES    ("'.$game_name.'", '.$pun_user['id'].', '.$score.', '.$topscore.', '.$now.')';        $query = $db->query($sql) or error("Impossible to insert the new score", __FILE__, __LINE__, $db->error());                $sql = 'SELECT game_id FROM '.$db->prefix.'arcade_games WHERE game_filename = "'.$game_name.'"';        $query = $db->query($sql) or error("Impossible to select the game", __FILE__, __LINE__, $db->error());        $gameid = $db->fetch_assoc($query);        echo '<script type="text/javascript">window.location= "arcade_ranking.php?id='.$gameid['game_id'].'"</script>';
    }
}
else{
    error($lang_common['No permission']);
}
?>

Offline

 

#32 2009-06-09 11:44:59

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

im having some problems here too... on all versions on the arcade! cant get it to work

pandark version doesnt work.
this version doesnt work either: http://www.berger-feld.de/index.php?opt … ;Itemid=37
it is giving me parsing error on the last line so i change:

Code:

<?// Generate page links

to

Code:

<?php // Generate page links

and now it is giving me garbled text on the boxes like this one on the first left box:

Code:

query('SELECT game_id, game_name, game_image FROM '.$db->prefix.'arcade_games ORDER BY game_id DESC LIMIT '.$pun_config['arcade_numnew'].'') or error('Unable to get latest games', __FILE__, __LINE__, $db->error()); $i = 1; while($line = $db->fetch_assoc($result2)) { echo ' '.$line['game_name'].'

'; $i++; } ?>

i think it has some trouble wiring with the database. please please someone help me on this i really need to install this mod. this is the main show of my planned forum. sad

Last edited by joe.banana (2009-06-09 11:45:49)

Offline

 

#33 2009-06-09 21:24:03

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: PunArcade portal

PunBB Arcade Mod 1.1a (2009-09-20)

There is very good arcade mod for punbb 1.2 available at:
http://www.berger-feld.de/index.php?opt … ;Itemid=37

But it's not maintained anymore, and contains many SQL injection vulnerabilities. So therefore I decided to release an unofficial update of this mod here.

Download PunBB Arcade Mod 1.1a

Language packs:
German
French

Additional game packs can be downloaded from the author's website.

## CHANGELOG:

## v1.1a   :

1. replaced all <? with <?php in all php files (there were quite a few)

2. in newscore.php:
replaced all $HTTP_POST_VARS['score'] with $_POST['score']
replaced all mysql_num_rows($query) with $db->num_rows($query)

3. made some fixes to the readme

4. fixed numerous security and SQL injection vulnerabilities

5. made some fixes to the database install script

6. other minor changes and improvements

Last edited by Koos (2009-10-10 12:24:02)

Offline

 

#34 2009-06-09 22:57:01

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

Thanks a ton Koos! but the link aint working can you pretty please update it.
thanks a lot!

Offline

 

#35 2009-06-09 23:07:53

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: PunArcade portal

Sorry about that, it should work now. By the way: I have noticed some SQL injection vulnerabilities in this mod. I will try to fix it tomorrow.

Offline

 

#36 2009-06-10 00:27:52

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

Thanks for updating it Koos, pretty please do update it a lot of people will be happy im sure. smile specially with the SQL injection is quite worrying.

Now, I get this error with your update:

Warning: ob_start() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in C:\wamp\www\flux\include\functions.php on line 961
An error was encountered
Error: Unable to get latest games.

*edit disable the gzip and now the page works except thumbnails on the top boxes wont show. sad

also is it possible for me to use this one with gzip? thanks..

Last edited by joe.banana (2009-06-10 01:23:48)

Offline

 

#37 2009-06-10 20:32:40

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: PunArcade portal

That's strange. I've also tested it in wamp with gzip enabled, and I don't get any errors. All the thumbnails also display.

Offline

 

#38 2009-06-10 23:09:23

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

Also cant play the game when i click on the empty thumbnails.. sad

Im using wamp by the way in case that helps Koos..

Offline

 

#39 2009-06-11 07:22:36

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: PunArcade portal

Like I said above: I did not include the 'games' folder in my arcade update. You have to get that from the original mod.

Offline

 

#40 2009-06-11 11:13:36

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

Hi Koos,

Yes I did install the original mod first before replacing it with your files. but i dont think it's wiring well on my end.. sad

Offline

 

#41 2009-06-11 18:23:10

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: PunArcade portal

Send me an email. I will try to help you sort this out.

Offline

 

#42 2009-06-11 22:57:48

FSX
Member
Registered: 2006-09-14
Posts: 593
Website

Re: PunArcade portal

Hey, I saw a post about this mod a long time ago where someone said it's possible to send scores to the database by sending a POST request to the server without playing a game (cheating). I think this can be solved with a referer check or anti-csrf token.

Offline

 

#43 2009-06-12 00:44:06

MattF
Member
From: South Yorkshire, England
Registered: 2007-03-16
Posts: 415

Re: PunArcade portal

FSX wrote:

Hey, I saw a post about this mod a long time ago where someone said it's possible to send scores to the database by sending a POST request to the server without playing a game (cheating). I think this can be solved with a referer check or anti-csrf token.

I seem to recall that when this subject came up in the past, it was pretty much said that it was nigh on impossible to reliably prevent cheating via means external to the games themselves.

Offline

 

#44 2009-06-13 04:55:00

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

Update: working pretty fine now, was able to fix it for some reason after the fifth install.
Thanks for the support Koos, Arcade is looking great! Is this based on phpBB's arcade? What is the diff between pandark's version and the one being updated by Koos?

Offline

 

#45 2009-06-14 10:37:37

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

Does games from here work? Cause I can see most downloaded games from phpbb came from here:

http://www.ultimatearcade.com/

Thanks..

edit: just tried it out, it seems to connect to their site so guess not..
so anyone know how to atleast make IPB games compatible?

Last edited by joe.banana (2009-06-14 12:55:42)

Offline

 

#46 2009-06-14 18:18:19

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: PunArcade portal

FSX wrote:

Hey, I saw a post about this mod a long time ago where someone said it's possible to send scores to the database by sending a POST request to the server without playing a game (cheating). I think this can be solved with a referrer check or anti-csrf token.

I read about this as well at the punbb forum in this topic. Smartys mentioned that the referer check can be faked - not sure about the anti-csrf token though. Maybe the easiest solution would be, as Smartys also mentioned, to encrypt the scores before it is sent.

But there are always other ways of cheating in some flash based games, e.g. using memory hacking software.

Offline

 

#47 2009-06-18 13:20:01

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

forumdesados wrote:

Could anyone help me please, I have a major problem...

When i want to save a score, I've an error:

Parse error: syntax error, unexpected '}' in /home/forumdes/public_html/newscore.php on line 8

I've not changed anything in my newscore.php

Sorry for the bad english i use, i'm french :s

That is my newscore.php:

just had this same problem when submitting scores.. the thing is everything works well on my computer but when i upload it i get this.. im pretty sure all the files are correct.

What's with the extra "}"? i cant see.. sad

Offline

 

#48 2009-06-18 20:21:39

Koos
Administrator
Registered: 2007-01-14
Posts: 524
Website

Re: PunArcade portal

I've updated my Arcade Update above. See if it fixes your problem.

This update also fixes the SQL injection vulnerabilities.

Offline

 

#49 2009-06-18 22:34:21

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

wow!!! Koos you are the best! smile without you the pun/flux project are not as good as they are.. tongue

Offline

 

#50 2009-06-19 09:59:18

joe.banana
Member
From: ph
Registered: 2009-05-15
Posts: 30
Website

Re: PunArcade portal

it still got that problem.. sad even on newly installed fluxbb on my host.. but it works just fine on the wamp server..

edit: the problem happend on both web server i tested it on..

Last edited by joe.banana (2009-06-19 11:52:04)

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.