• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

chat DB archive for version 1.0-beta-8

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
2 posts • Page 1 of 1

Postby serrod1981 » Thu Aug 30, 2007 2:14 pm

I created a dirty fix to archive chat activity onto mysql ; two file will need to be modified:
file.class.php and pfccontainer.class.php
On file.class.php add this function:
/**
* funtions to log chat activity to db // DeveloperShed Sergio F. Rodriguez
*
**/
function setLog($chan, $today, $hour, $m, $nick, $msg ,$cmd){
$c =& $this->c;
//connect to db//
$con = mysql_connect($hostane= 'xx.xx.xx.xx',$username= 'xxx', $password='xxxx');
//select db//
$sel = mysql_select_db('Db_name');
//set query//
$query = "INSERT INTO `Table`.`chat_log`
( `id` , `chatname` ,`date` , `time` ,`m` , `nick` ,`log`, `cmd`)
VALUES
(NULL , '$chan' , '$today', '$hour', '$m', '$nick', '$msg' ,'$cmd' )";
//run query//
$sql = mysql_query($query) or die('error'. mysql_error());

}

On pfccontainer.class.php add the following:
//this call goes WITHIN the funtion write//
//right after
//write message "$this->setMeta("channelid-to-msg", $this->encode($chan), $msgid, $data);"

//write log into db developershed sergio f. rodriguez//
$today = date("d/m/Y");
$hour = date("H:i:s");
$m = date('A');
//this will call to do the db insertion //
$this->setLog($this->encode($chan),$today, $hour, $m, $nick, $param, $cmd);

In the same file pfccontainer.class.php at the end of the class add:

/*
*log system developer shed // sergio f. rodriguez
*
*/
function setLog($group, $subgroup, $leaf, $leafvalue = NULL)
{ die(_pfc("%s must be implemented", get_class($this)."::".__FUNCTION__)); }


Now lets create the db table:



Now your phpfreechat has a DB driven activity log.
Cheers!
Last edited by serrod1981 on Thu Aug 30, 2007 2:19 pm, edited 1 time in total.
serrod1981
New member
 
Posts: 2
Joined: Thu Aug 30, 2007 1:54 pm
Top

Postby phpfreechat » Mon Sep 03, 2007 7:12 am

Thank you for sharing serrod1981.
I just want to add my comments about the way to handle logs. For me, the best way to do it is to plugin the log proxy in src/proxies/log.class.php
phpfreechat
Site Admin
 
Posts: 2657
Joined: Tue Feb 07, 2006 3:35 pm
Location: France
Top


Post a reply
2 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 7 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub