View next topic
View previous topic
Post new topic   Reply to topic
Author Message
Guardian




Joined: Dec 09, 2006
Posts: 249

PostPosted: Thu May 01, 2008 5:03 pm
Reply with quote

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 
View user's profile Send private message
corpse




Joined: Apr 06, 2008
Posts: 30

PostPosted: Fri May 02, 2008 4:22 am
Reply with quote

huh.
 
View user's profile Send private message Visit poster's website
corpse




Joined: Apr 06, 2008
Posts: 30

PostPosted: Fri May 02, 2008 1:42 pm
Reply with quote

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>";
?>
 
View user's profile Send private message Visit poster's website
xt-wax




Joined: Jun 15, 2008
Posts: 8

PostPosted: Sun Jun 22, 2008 11:06 am
Reply with quote

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 Tue Jun 24, 2008 4:35 pm; edited 3 times in total 
View user's profile Send private message
Guardian




Joined: Dec 09, 2006
Posts: 249

PostPosted: Sun Jun 22, 2008 12:09 pm
Reply with quote

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 
View user's profile Send private message
xt-wax




Joined: Jun 15, 2008
Posts: 8

PostPosted: Sun Jun 22, 2008 3:50 pm
Reply with quote

Thats me and my fast typing skills with 2 fingers... did not intend on haveing 2 "n"'s in the site address. Embarassed

Has been fixed to reflect Rave Nuke rather than Raven Nuke. Thanks.
 
View user's profile Send private message
Guardian




Joined: Dec 09, 2006
Posts: 249

PostPosted: Sun Jun 22, 2008 4:05 pm
Reply with quote

No problem and thanks Smile

_________________
Code Authors Nuke Reviews 
View user's profile Send private message
xt-wax




Joined: Jun 15, 2008
Posts: 8

PostPosted: Mon Jun 23, 2008 4:04 pm
Reply with quote

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.
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 5 Hours