CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Adding the change log data on php-mysql CCS 4.3

Print topic Send  topic

Author Message
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);
}
View profile  Send private message
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
View profile  Send private message
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
View profile  Send private message
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);
}
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.