vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB Chat (https://vborg.vbsupport.ru/forumdisplay.php?f=107)
-   -   Chat Log (https://vborg.vbsupport.ru/showthread.php?t=77672)

pets.ca 03-07-2005 07:01 PM

Chat Log
 
Hi there,

I require the ability to keep a log of all chat activity on my board. I plan to have a single chat room only. Is there a way to dump all activity (time/date stamped) to a text file?

thanks

dave

wacnstac 03-07-2005 11:52 PM

This would be useful to me as well.

Zero Tolerance 03-08-2005 05:38 PM

It may be created for a future version, thats not a promise.

- Zero Tolerance

sv1cec 03-09-2005 09:10 AM

Quote:

Originally Posted by Zero Tolerance
It may be created for a future version, thats not a promise.

- Zero Tolerance

If I may, add this code at the end of your admin_vbchat.php file, before the ?> :

PHP Code:

// ###################### Do View Messages ########################
if ($_GET['do'] == "viewmessages" 
{
    
$file="vbchat_store";
    
globalize($_REQUEST, array(
        
'sid' => INT,
        
'perpage' => INT,
        
'page' => INT,
        
'orderby' => STR,
    ));
    
print_cp_header("vBChat System");
    
    
$perpage=20;
    
    if (
$page 1)
    {
        
$page 1;
    }
    
$startat = ($page 1) * $perpage;
    
    
$counter=$DB_site->query_first("SELECT COUNT(*) AS messages FROM " TABLE_PREFIX "{$file} AS message");
    
    if (
$counter['messages']==or $counter['messages']=='')
    {
        
$url='admin_vbchat.php';
        
$wait=5;
        
print_cp_message("No Chat Messages to Show."$url$wait);
    }
    
    
$totalpages ceil($counter['messages'] / $perpage);
        
    
$Get_Chat_MSG $DB_site->query("select m.*,u.*,t.username AS tusername, t.userid AS tuserid from ".TABLE_PREFIX."{$file} m
        left join "
.TABLE_PREFIX."user u on (u.userid = m.s_postby) 
        left join "
.TABLE_PREFIX."user t on (t.userid = m.s_foruser)
        order by m.s_postime LIMIT 
$startat$perpage");
    
    if (
$DB_site->num_rows($Get_Chat_MSG))
    {
            
        if (
$page != 1)
        {
            
$prv $page 1;
            
$firstpage "<input type=\"button\" class=\"button\" value=\"&laquo; " $vbphrase['first_page'] . "\" tabindex=\"1\" onclick=\"window.location='admin_vbchat.php?$session[sessionurl]do=viewmessages&perpage=$perpage&orderby=$orderby&file=$file&page=1'\">";
            
$prevpage "<input type=\"button\" class=\"button\" value=\"&lt; " $vbphrase['prev_page'] . "\" tabindex=\"1\" onclick=\"window.location='admin_vbchat.php?$session[sessionurl]do=viewmessages&perpage=$perpage&orderby=$orderby&file=$file&page=$prv'\">";
        }
    
        if (
$page != $totalpages)
        {
            
$nxt $page 1;
            
$nextpage "<input type=\"button\" class=\"button\" value=\"" $vbphrase['next_page'] . " &gt;\" tabindex=\"1\" onclick=\"window.location='admin_vbchat.php?$session[sessionurl]do=viewmessages&perpage=$perpage&orderby=$orderby&file=$file&page=$nxt'\">";
            
$lastpage "<input type=\"button\" class=\"button\" value=\"" $vbphrase['last_page'] . " &raquo;\" tabindex=\"1\" onclick=\"window.location='admin_vbchat.php?$session[sessionurl]do=viewmessages&perpage=$perpage&orderby=$orderby&file=$file&page=$totalpages'\">";
        }
    
        
$aa=($page-1)*$perpage+1;
        if (
$page<$totalpages)
        {
            
$bb=$page*$perpage;
        }
        else
        {
            
$bb=$counter['messages'];
        }
        
$cc=$counter['messages'];    

        
print_form_header('''');
        
        
print_table_header("View vBChat Messages<br>Page $page of $totalpages<br>Messages $aa to $bb of $cc",14);
                
        
$header = array();
        
        
$header[] = "<b>ID</b>";
        
$header[] = "<b>Poster Name</b>";
        
$header[] = "<b>Message</b>";
        
$header[] = "<b>Date/Time</b>";
        
$header[] = "<b>To User</b>";
            
        
print_cells_row($header1);
        
        while(
$message=$DB_site->fetch_array($Get_Chat_MSG))
        {
        
            
$cell = array();
            
//             $message[date] = vbdate ( $vboptions['dateformat'], $message[s_postime] ) ;
             
$message[time] = vbdate $vboptions['timeformat'], $message[s_postime] ) ;
            
$message[date]=date("d-m-Y");

            if(
$message['s_foruser']=="0")
            {
                
$touser='All';
            }
            else
            {
                
$touser=$message[tusername];
            }
            
            
$cell[] = "<font size='-1'>$message[sid]</font>";
            
$cell[] = "<font size='-1'>$message[username]<br>$message[userid]</font>";
            
$cell[] = "<font size='-1'>$message[s_message]</font>";
            
$cell[] = "<font size='-1'>$message[date]<br>$message[time]</font>";
            
$cell[] = "<font size='-1'>$touser<br>$message[tuserid]</font>";
            
            
print_cells_row($cell);
            
        }
        
print_table_footer(5"$firstpage $prevpage &nbsp; $nextpage $lastpage");
    }


Then edit your admincp/index.php file and find:

PHP Code:

construct_nav_option 'Chat Prune Options''admin_vbchat.php?do=prune''<br />' ) ; 

Right below that, add:

PHP Code:

construct_nav_option 'Chat Log''admin_vbchat.php?do=viewmessages''<br />' ) ; 

Let me know if that works.

Of course, you should not have the prune chat option active, or else the messages will be deleted.

AzHousePro 03-20-2005 07:09 AM

Looks like it works to me. Nice job.

How hard would it be to code something that dumped the entire log to a text file on the server?

Mike

Deaths 03-20-2005 10:23 AM

Why dump it to a .txt file, if it's already in the DB?

AzHousePro 03-20-2005 04:25 PM

Just thought it would be nice to dump the log to a text file every once in a while and purge the database.

Mike

sv1cec 03-24-2005 02:39 AM

That, Sir, I have no idea how to do it.

Diana Notacat 04-17-2005 01:57 AM

This was brilliantly useful!

Is it possible to make some modifications to this to allowing viewing logs for the created rooms as well? Perhaps a menu to "view Logs for X room"?

Deaths 04-17-2005 05:57 AM

Would you want it to be an actual file on your server, which is updated at regular bases, or do you just want to be able to download the .txt file?


All times are GMT. The time now is 12:34 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01037 seconds
  • Memory Usage 1,792KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete