View Single Post
  #1 (permalink)  
Old 04-15-2003, 10:02 PM
Foolio882 Foolio882 is offline
Junior Member
 
Join Date: Apr 2003
Location: Northern Virginia
Posts: 29
Send a message via AIM to Foolio882 Send a message via MSN to Foolio882 Send a message via Yahoo to Foolio882
My who's online block...
Ok, heres some edited code for the who's online block. I just wante dit to say how many people were on total (and i dont have any registered members, disabled that too) so tell me what you think!



Code:
<?php 

######################################################################## 
# PHP-Nuke Block: Who_is_Online v0.2                                   # 
#                                                                      # 
# Copyright (c) 2003 by C. Wade (wadece@offreviews.com)                # 
#                                                                      # 
######################################################################## 
# This program is free software. You can redistribute it and/or modify # 
# it under the terms of the GNU General Public License as published by # 
# the Free Software Foundation; either version 2 of the License.       # 
######################################################################## 

if (eregi("block-Who_is_Online.php", $_SERVER['PHP_SELF'])) { 
    Header("Location: index.php"); 
    die(); 
} 

global $user, $cookie, $prefix, $db, $user_prefix; 

cookiedecode($user); 
$ip = $_SERVER["REMOTE_ADDR"]; 
$uname = $cookie[1]; 
if (!isset($uname)) { 
    $uname = "$ip"; 
    $guest = 1; 
} 

$nmh = "people looking at OffReviews.com.";

$guest_online_num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_session WHERE guest='1'")); 
$member_online_num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_session WHERE guest='0'")); 

$who_online_num = $guest_online_num + $member_online_num; 
$who_online = "<center><font class=\"content\">"._CURRENTLY." $guest_online_num ".$nmh." 
"; 

$content = "$who_online"; 

if (is_user($user)) { 
    if (is_active("Private_Messages")) { 
   $sql = "SELECT user_id FROM ".$user_prefix."_users WHERE username='$uname'"; 
   $result = $db->sql_query($sql); 
   $row = $db->sql_fetchrow($result); 
   $uid = $row[user_id]; 
   $newpm = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_bbprivmsgs WHERE privmsgs_to_userid='$uid' AND (privmsgs_type='5' OR privmsgs_type='1')")); 
    } 
} 

$sql = "SELECT title FROM ".$prefix."_blocks WHERE bkey='online'"; 
$result = $db->sql_query($sql); 
$row = $db->sql_fetchrow($result); 
$title = $row[title]; 

?>
The only problem is, after the word "Currently" there is an annoying comma that i cant seem to get rid of. You can check what i mean by going to... www.offreviews.com and looking on the left side, down a little bit.

Any help would be much appreciated

also, if this has been done before, i apologize, the only people i could find who did it did it by hand and wouldnt tell me how.
Reply With Quote