3.9. Logging user actions

You can log user actions into a special "changelog" table. You must have table created and specified for phpMyEdit using the $opts['logtable'] option.

Example 3-26. Logging

$opts['logtable'] = 'changelog';

Example 3-27. Log table schema

CREATE TABLE changelog ( 
   updated timestamp(14) default NULL,
   user varchar(255) default NULL,
   host varchar(255) default NULL,
   operation varchar(255) default NULL,
   tab varchar(255) default NULL,
   rowkey varchar(255) default NULL,
   col varchar(255) default NULL,
   oldval blob default NULL,
   newval blob default NULL 
);

phpMyEdit provides also the possibility of notifying about performed user actions by sending informational e-mail. This feature configuration is done via $opts['notify'] array with following variables notation. Note that on every place where one e-mail address should be written, it is possible to have array of multiple e-mail addresses there. This feature is provided for informing more than one user about particular performed action.

$opts['notify']['from']   sender envelope e-mail address (webmaster@SERVER_NAME by default)
$opts['notify']['prefix']   prefix of e-mail messages subject (no prefix by default)
$opts['notify']['wrap']   maximum width of e-mail message body (by default 72 will be used)
$opts['notify']['insert']   e-mail address for insert action notification
$opts['notify']['update']   e-mail address for update action notification
$opts['notify']['delete']   e-mail address for delete action notification
$opts['notify']['all']   e-mail address for all actions notification

In both cases, changelog table and e-mail notyfing are values of "user" extracted from the variables in following order: $_SERVER['REMOTE_USER'], $_SERVER['REMOTE_USER'] and global variable $REMOTE_USER. Similary "host" variable is checked in $_SERVER['REMOTE_ADDR'], than in $_SERVER['REMOTE_ADDR'] and at the end in global variable $REMOTE_ADDR.


Bootstrap phpMyEdit PHP Form Generator