<?
class auditTrail{
    	var $auditTrailPkey;
	var $employeePkey;
	var $auditTrailDateTime;
	var $auditTrailIP;
	var $auditTrailModule;
	var $auditTrailTransaction;

    function audittrail_add($module, $auditTrailTransaction, $sqlTransaction, $userpkey="")
    {
		global $db_pms,$tbl_audittrail;
		
		$today = getdate();
		//$domain = GetHostByName($REMOTE_ADDR);
		$domain = getenv("REMOTE_ADDR");
        	$new_auditTrailTransaction = ereg_replace("'","`",$auditTrailTransaction);
		$new_sqlTransaction = ereg_replace("'","`",$sqlTransaction);
		if ($userpkey=="") $userpkey = $_SESSION['Xuserpkey'];
		
        
        $insert_audittrail="insert into system_audittrail (audit_pkey, audit_userpkey, audit_datetime, audit_ip, audit_module, audit_transaction, audit_transactiondetails) values ('".md5(microtime())."','".$userpkey."','".$today[0]."','".$domain."','".$module."','".$new_auditTrailTransaction."','".$new_sqlTransaction."' )";
        $result_audittrail =& $db_pms->query($insert_audittrail);
	}
}
?>