| Author |
Message |
Guardian
Mr. Awesome

Joined: Dec 09, 2006
Posts: 240
|
Posted:
Fri May 02, 2008 8:03 am |
|
This is weird. I just opened two browser windows with me 'online' in the chat room and then opened another browser to see if I'm in the table through phpmyadmin and it's empty :
( |
_________________ Code Authors Nuke Reviews |
|
|
 |
corpse
Repeat Offender

Joined: Apr 06, 2008
Posts: 30
|
Posted:
Fri May 02, 2008 7:22 pm |
|
|
|
 |
corpse
Repeat Offender

Joined: Apr 06, 2008
Posts: 30
|
Posted:
Sat May 03, 2008 4:42 am |
|
Okay, I finaly got it. We were all close, but this is what I am using and it does work on phpnuke 7.9.
| Code: |
<?PHP
if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
global $db, $prefix;
$query2 = 'SELECT COUNT(username) FROM '.$prefix.'_live_online WHERE timestamp>\''.(time() - 60).'\' ORDER BY username ASC';
$result2 = $db->sql_query($query2);
list($chat_user_count) = $db->sql_fetchrow($result2);
$content ="<center>Amount Users<br>In Chat: ";
$content .=$chat_user_count;
$content .="</center>";
?> |
|
|
|
|
 |
xt-wax
Newbie


Joined: Jun 15, 2008
Posts: 8
|
Posted:
Mon Jun 23, 2008 2:06 am |
|
I created a block to display who is in chat, how many are in chat and provide a link to your chat. You can copy the code below and create your block or download it from http://www.ravenuke.com/modules.php?name=Downloads&d_op=getit&lid=11
www.ravenuke.com
If anyone has any tweeks or addons to make to this block, please let me know and I will add them to it.
Enjoy.
| Code: |
<?PHP
/************************************************************************/
/* Code created by XT-Wax at www.RaveNuke.com */
/* Please keep all copyright info in file... Thanks */
/* Copyright (c) 2007 by XT-Wax */
/* http://www.RaveNuke.com */
/* Email suggestions and tweeks to this block: webmaster@ravenuke.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. */
/* Free to use and distribute, but Copyright must stay in code. Thanks. */
/* */
/************************************************************************/
/* Download this block and other scripts from http://ravenuke.com */
/* */
/* This block is designeed to work with Live Chat which can be */
/* downloaded at http://nukecoder.com (Thanks for this awesome chat) */
/* */
/************************************************************************/
if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
$content = '';
global $admin, $user, $cookie, $prefix, $user_prefix, $db, $dbi, $anonymous, $name, $lang, $sql;
//Function to call number of chatters in chat room
$count = 'SELECT COUNT(username) FROM '.$prefix.'_live_online WHERE timestamp>\''.(time() - 60).'\' ORDER BY username ASC';
$count_results = $db->sql_query($count);
list($chat_user_count) = $db->sql_fetchrow($count_results);
$content .="<center>Number of Chatters:<br>("; // <--- Change "Number of Chatters:" here iF you like
$content .=$chat_user_count;
$content .=")</center>";
//Function to call current users in chat
$user_display = 'SELECT username FROM '.$prefix.'_live_online WHERE timestamp>\''.(time() - 60).'\' ORDER BY username ASC LIMIT 0,50';
$results = $db->sql_query($user_display);
$content .="<br /><center><strong>Who's Chatting:</strong><br /><br /> "; // <--- Change "Who's Chatting:" here iF you like
if ($db->sql_numrows($result)) {
while (list($username) = $db->sql_fetchrow($result)) {
$content .= '<div align=center>* '.$username.'</div>';
}
} else {
$content .= 'No Ones Chatting';
}
$content .="</center>";
//Link to Live_Chat module... Change address if needed
$content .= "<BR><center><a href='modules.php?name=Live_Chat'>JOIN CHAT NOW</a></center>"; // <---- Change "Live_Chat" to your module name IF changed name
//Please retain below info
$content .= "<BR><BR><center><font size=\"0\">Powered By</font></center>";
$content .= "<center><a href=\"http://www.RaveNuke.com/index.php\"><font size=\"0\">www.RaveNuke.com</font></a></center>";
?> |
|
Last edited by xt-wax on Wed Jun 25, 2008 7:35 am; edited 3 times in total |
|
|
 |
Guardian
Mr. Awesome

Joined: Dec 09, 2006
Posts: 240
|
Posted:
Mon Jun 23, 2008 3:09 am |
|
Thanks for that.
You may want to review your meta tags etc Ravennuke is a trademark and you are not using it so it could have the potential to adveresly affect your SERP's. |
_________________ Code Authors Nuke Reviews |
|
|
 |
xt-wax
Newbie


Joined: Jun 15, 2008
Posts: 8
|
Posted:
Mon Jun 23, 2008 6:50 am |
|
Thats me and my fast typing skills with 2 fingers... did not intend on haveing 2 "n"'s in the site address.
Has been fixed to reflect Rave Nuke rather than Raven Nuke. Thanks. |
|
|
|
 |
Guardian
Mr. Awesome

Joined: Dec 09, 2006
Posts: 240
|
Posted:
Mon Jun 23, 2008 7:05 am |
|
|
|
 |
xt-wax
Newbie


Joined: Jun 15, 2008
Posts: 8
|
Posted:
Tue Jun 24, 2008 7:04 am |
|
I edited the code in my earlier post to add a timestamp to the users in chat. It was keeping them in the block as long as they were still browsing the site. Now they are removed after they leave the chat page.
I added " WHERE timestamp>\''.(time() - 60).'\' "
You can edit your code if you already have this by changing at or around line 44. You can change the 60 to a different number if desired.
Also, the " LIMIT 0,50 " can be changed to only show however many chatters you would like. For instance, 0,3 will only show the first 3 chatters.
Was:
| Code: |
$user_display = 'SELECT username FROM '.$prefix.'_live_online ORDER BY username ASC LIMIT 0,50';
|
Change:
| Code: |
$user_display = 'SELECT username FROM '.$prefix.'_live_online WHERE timestamp>\''.(time() - 60).'\' ORDER BY username ASC LIMIT 0,50';
|
Good luck. |
|
|
|
 |
|
|