rochmadi
Posts: 5
|
Posted: 06/15/2014, 11:19 PM |
|
To add log data changes do the following steps.
Create a table with the name "pro_appli_log" with the script:
CREATE TABLE `pro_appli_log` (
`userAccess` varchar(100) COLLATE latin1_general_ci DEFAULT NULL,
`login` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
`log_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`log_id` int(11) NOT NULL AUTO_INCREMENT,
`ip` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
PRIMARY KEY (`log_id`),
KEY `userAccess` (`userAccess`),
KEY `login` (`login`)
) ENGINE=MyISAM AUTO_INCREMENT=28213 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
Insert the following line of code in the file db_mysql.php on line 157.
if ($this->Debug)
printf("Debug: query = %s<br>\n", $Query_String);
$arr = explode(' ',trim($Query_String));
$FileName=FileName;
$UserID = CCGetUserLogin();
if(strlen(CCGetUserID()) and strtolower($arr[0])!="select" and !strpos($Query_String, 'pro_appli_log') ) {
$xx = @mysql_query('INSERT INTO pro_log_query SET user="'.$UserID.'",query="'.$Query_String.'",FileName="'.$FileName.'"',$this->Link_ID);
}
|
|
|
eratech
Posts: 513
|
Posted: 06/16/2014, 12:19 AM |
|
rochmadi - good timing as I need something like this.
I can implement my own, but for the sake of any copy/pasters, the SQL table definition does not match the PHP though (pro_appli_log and pro_log_query)
Cheers
E
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
eratech
Posts: 513
|
Posted: 06/16/2014, 12:30 AM |
|
rochmadi - good timing as I need something like this.
I can fix the code, but for the sake of any copy/pasters, the SQL table definition does not match the PHP though (pro_appli_log and pro_log_query)
Cheers
E
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
rochmadi
Posts: 5
|
Posted: 06/16/2014, 3:25 AM |
|
yes, I was wrong, should be :
CREATE TABLE `pro_log_query` (
`Id_log` int(11) NOT NULL AUTO_INCREMENT,
`user` varchar(40) COLLATE latin1_general_ci DEFAULT NULL,
`query` varchar(1024) COLLATE latin1_general_ci DEFAULT NULL,
`log_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`FileName` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
PRIMARY KEY (`Id_log`)
) ENGINE=MyISAM AUTO_INCREMENT=138927 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
and change its code into
$arr = explode(' ',trim($Query_String));
$FileName=FileName;
$UserID = CCGetUserLogin();
if(strlen(CCGetUserID()) and strtolower($arr[0])!="select" ) {
$xx = @mysql_query('INSERT INTO pro_log_query SET user="'.$UserID.'",query="'.$Query_String.'",FileName="'.$FileName.'"',$this->Link_ID);
}
|
|
|
|