1 (edited by SuperMAG 2008-03-18 22:04)

Topic: Need a litttle help in my Online.php page

Need a litttle help in my Online.php page ... the online page is came from some modification i dont know where is it now ... but it was called punonline i guess ...

my online page only shows the pages that are orignally in punbb like userlist, search, login, registering, veiwforum, viewtopic ..., forum index, etc

but it does not view the pages which were maded by modifications ...

like the following pages:

i want to see custom pages with the page name
i want to see if they were viewing blogs and also which blogs they are viewing
i want to see if they were viewing arcade and also which game they are viewing
Rules page
links page
Gallery page
chatbox page
Contact Us page
and finally Downloads page


here is my online page:

 
<?php
define('PUN_ALT4',1);
define ('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

if ($pun_user['is_guest'] && $pun_user['g_read_board'] == '0')
        message($lang_common['No permission']);


// Load the userlist.php language file

require PUN_ROOT.'lang/'.$pun_user['language'].'/userlist.php';
// Load the online.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/online.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_online['Online List'];
require PUN_ROOT.'header.php';
?>
<div class="blocktable">
    <h2><span><?php echo $lang_online['Online List'] ?></span></h2>
    <div class="box">
        <div class="inbox">
            <table cellspacing="0">
            <tr>
                <th class="tcr" style="text-align: center; border-left: 0px;" scope="col"><?php echo $lang_common['Username'] ?></th>
                <th class="tcr" style="text-align: center; border-left: 0px;" scope="col"><?php echo $lang_online['Last action'] ?></th>
                <th class="tcr" style="text-align: center; border-left: 0px;" scope="col"><?php echo $lang_online['Time'] ?></th>
                <?php 
    if($pun_user['g_id'] <= PUN_MOD)
    { 
?>
                <th style="text-align: center; border-left: 0px;" class="tcr" scope="col"><?php echo $lang_online['IP'] ?></th>
<?php 
        echo "\n";
    }
?>
    </tr>
            
            

<?php


// Grab the users
$result = $db->query('SELECT * FROM '.$db->prefix.'online WHERE user_id > 0 AND idle=0 ORDER BY ident') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
$num_users_page = $db->num_rows($result);

if ($num_users_page) {
  while ($num_users_page--) {
   $user_data = $db->fetch_assoc($result);
    if ($user_data['current_page']) {
        echo"\t\t\t\t".'<tr>'."\n";
        
    if ($user_data['user_id'] > 1) 
          echo "\t\t\t\t\t".'<td style="text-align: left; border-left: 0px;"><img style="vertical-align: middle;" src="'.$pun_config['o_base_url'].'/img/ip.gif" title="'.$lang_online['Online'].'" alt="'.$lang_online['Online'].'" /> <a href="'.PUN_ROOT.'profile.php?id='.$user_data['user_id'].'">'.$user_data['ident'].'</a></td>'."\n";
    else 
        echo "\t\t\t\t\t".'<td style="text-align: left; border-left: 0px;"><img style="vertical-align: middle;" src="'.$pun_config['o_base_url'].'/img/ip.gif" title="'.$lang_online['Online'].'" alt="'.$lang_online['Online'].'" /> '.$lang_online['Guest'].'</td>'."\n";

$pathinfo = pathinfo($user_data['current_page']);
$current_page = $pathinfo['basename'];

if ($user_data['current_page_id'] > 0) {
    if ($current_page == "viewtopic.php" || $current_page == "post.php") { $current_page_name = $db->query('SELECT subject FROM '.$db->prefix.'topics WHERE id=\''.$user_data['current_page_id'].'\'') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); }
    if ($current_page == "viewforum.php") { $current_page_name = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id=\''.$user_data['current_page_id'].'\'') or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); }
    if ($current_page == "profile.php") { $current_page_name = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id=\''.$user_data['current_page_id'].'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); }
    if ($current_page == "post.php" || $current_page == "edit.php") { echo"\t\t\t\t\t".'<td>'.$lang_online[$user_data['current_page']].': <b><a href="'.PUN_ROOT.'viewtopic.php?id='.$user_data['current_page_id'].'">'.$db->result($current_page_name, 0).'</a></b></td>'."\n";}
    
    else { echo"\t\t\t\t\t".'<td style="text-align: left;">'.$lang_online[$user_data['current_page']].': <b><a href="'.$user_data['current_page'].'?id='.$user_data['current_page_id'].'">'.$db->result($current_page_name, 0).'</a></b></td>'."\n";}

}else if ((@$lang_online[$user_data['current_page']]) == '')
        echo"\t\t\t\t\t".'<td style="text-align: left;">'.$lang_online['Hiding Somewhere'].'</td>'."\n";
    else
        echo"\t\t\t\t\t".'<td style="text-align: left;"><a href="'.$user_data['current_page'].'">'.$lang_online[$user_data['current_page']].'</a></td>'."\n";    


echo"\t\t\t\t\t".'<td style="text-align: center;">'.format_time($user_data['logged']).'</td>'."\n";

if ($pun_user['g_id'] <= PUN_MOD) echo"\t\t\t\t\t".'<td style="text-align: center;"><a href="'.PUN_ROOT.'admin_users.php?show_users='.$user_data['current_ip'].'">'.$user_data['current_ip'].'</a></td>'."\n";
echo"\t\t\t\t".'</tr>'."\n";
} } }
else { echo "\t\t\t\t".'<tr><td colspan="4">'.$lang_online['No users'].'</td>'."\n\t\t\t\t".'</tr>'."\n"; }
?>
                        </table>
        </div>
    </div>
</div>

<?php
require PUN_ROOT.'footer.php';

i think it has some thing to be added to

 
if ($current_page == "viewtopic.php" || $current_page == "post.php") { $current_page_name = $db->query('SELECT subject FROM '.$db->prefix.'topics WHERE id=\''.$user_data['current_page_id'].'\'') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); }
    if ($current_page == "viewforum.php") { $current_page_name = $db->query('SELECT forum_name FROM '.$db->prefix.'forums WHERE id=\''.$user_data['current_page_id'].'\'') or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); }
    if ($current_page == "profile.php") { $current_page_name = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id=\''.$user_data['current_page_id'].'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); }
    if ($current_page == "post.php" || $current_page == "edit.php") { echo"\t\t\t\t\t".'<td>'.$lang_online[$user_data['current_page']].': <b><a href="'.PUN_ROOT.'viewtopic.php?id='.$user_data['current_page_id'].'">'.$db->result($current_page_name, 0).'</a></b></td>'."\n";}
    if ($current_page == "page.php" || $current_page == "page.php") { $current_page_name = $db->query('SELECT subject FROM '.$db->prefix.'pages WHERE id=\''.$user_data['current_page_id'].'\'') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); }

and the lang file:

<?php

$lang_online = array(

'Online List'            =>        'Online List',
'Detailed list'            =>        'Detailed List',
'Online list'            =>        'Online List',
'IP'                    =>        'IP',
'Guest'                    =>        'Guest',
'Last action'            =>        'Last Action',
'Online'                =>        'Online',
'Time'                    =>        'Time',
'No users'                =>        'No Users online.',
'Hiding Somewhere'        =>          'Hiding somewhere :)',
'/online.php'            =>        'Viewing users online list',
'/register.php'            =>        'Registering',
'/resources/faq.php'                =>        'Viewing FAQ',
'/calendar.php'            =>        'Viewing Calendar',
'/misc.php'                =>            'Miscellaneous',
'/message_list.php'        =>        'Managing private messages',
'/message_send.php'        =>        'Managing private messages',
'/message_delete.php'    =>        'Managing private messages',
'/index.php'                =>        'Viewing board index',
'/help.php'                =>        'Viewing help files',
'/login.php'                =>        'Logging in...',
'/post.php'                =>        'Posting a new message',
'/edit.php'                =>        'Editing...',
'/delete.php'            =>        'Deleting Message(s)',
'/profile.php'            =>        'Viewing profile',
'/search.php'            =>        'Searching...',
'/userlist.php'            =>        'Viewing user list',
'/viewtopic.php'            =>        'Viewing topic',
'/viewforum.php'            =>        'Viewing forum',
'/admin_index.php'        =>        'Viewing board index',
'/admin_bans.php'        =>        'Viewing board index',
'/admin_categories.php'    =>        'Viewing board index',
'/admin_censoring.php'    =>        'Viewing board index',
'/admin_forums.php'        =>        'Viewing board index',
'/admin_maintenance.php'    =>        'Viewing board index',
'/admin_options.php'        =>        'Viewing board index',
'/admin_permissions.php'    =>        'Viewing board index',
'/admin_prune.php'        =>        'Viewing board index',
'/admin_ranks.php'        =>        'Viewing board index',
'/admin_reports.php'        =>        'Viewing board index',
'/admin_users.php'        =>        'Viewing board index',
'/admin_modules.php'        =>        'Viewing board index',

);
MyFootballCafe.com  is Now Online!

Re: Need a litttle help in my Online.php page

any one

MyFootballCafe.com  is Now Online!