X7 Chat Support Board
Welcome, Guest. Please login or register.
July 31, 2010, 07:24:36 PM

Login with username, password and session length
Search:     Advanced search
X7 Chat Version 3.0.0 Alpha 2 is now available (http://x7chat.com/support_forum/index.php?topic=3198.msg11497#new).
13036 Posts in 3760 Topics by 66531 Members
Latest Member: yurapro1982
* Home Help Search Login Register
+  X7 Chat Support Board
|-+  X7 Chat Mods
| |-+  Developer Support
| | |-+  Who's Online php Block
« previous next »
Pages: [1] Reply Send this topic Print
Author Topic: Who's Online php Block  (Read 2233 times)
brundlefly
Member
*
Offline Offline

Posts: 1


View Profile
« on: March 24, 2007, 05:10:34 PM »
Reply with quote

Just a block for php-nuke that shows what members are in your php x7Chat.  It lists the names of all people in the chat system. I didn't see one on here, thought since I worked one out I'd provide for others.   Enjoy

Code:
<?php

if (eregi("block-Chat.php"$_SERVER['PHP_SELF'])) {
    
Header("Location: index.php");
    die();
}
global 
$prefix$db$sitename;
$exptime time()-5;
$result $db->sql_query("SELECT name FROM x7chat2_online WHERE invisible<>'1' AND time>'$exptime' ORDER BY time DESC LIMIT 10");
$content "<center><b>User(s) Online</b></center><br>";
while (
$row $db->sql_fetchrow($result)) {

    
$name $row['name'];
{
        
$content .= "<center>$name<br></center>";
    }
}
$content .= "<center><a href=\"Enter the link you want here\"><br><b><u>Join Chat</u></b></a></center>";
?>

Report to moderator   Logged
Mana
Guest


Email
« Reply #1 on: April 23, 2007, 09:56:42 PM »
Reply with quote

Eh...which directory should we upload this file in?
Report to moderator   Logged
Peter Koster
Member
*
Offline Offline

Posts: 184


View Profile WWW
« Reply #2 on: June 15, 2007, 04:56:45 PM »
Reply with quote

you don't upload the file, just copy and paste the code to any place on any page you wish the thing to appear.
Report to moderator   Logged

Peter
Squat toilets, travel guide about France
http://www.hurktoilet.nl/index-en.php
Slacker
Member
*
Offline Offline

Posts: 13


View Profile
« Reply #3 on: December 16, 2009, 09:51:35 AM »
Reply with quote

Thanks for the block and I have tried it a couple of days. It seems to be a small glitch because some members are shown several times as being online like this:

alex
alex
alex
alex
alex
christie
bob

Is there a fix for this?
Report to moderator   Logged
Slacker
Member
*
Offline Offline

Posts: 13


View Profile
« Reply #4 on: December 21, 2009, 01:23:25 PM »
Reply with quote

I think I have found a solution by using SELECT DISTINCT, which removes names in more instances, so that only one copy of each name is shown:

$result = $db->sql_query("SELECT name FROM x7chat2_online WHERE invisible<>'1' AND time>'$exptime' ORDER BY time DESC LIMIT 10");

change to:

$result = $db->sql_query("SELECT DISTINCT name FROM x7chat2_online WHERE invisible<>'1' AND time>'$exptime' ORDER BY time DESC LIMIT 10");
Report to moderator   Logged
Pages: [1] Reply Send this topic Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.075 seconds with 18 queries.