Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/firoz-ahmad-likhon/codeigniter-audit-trail

CodeIgniter audit trail is a convenient way to track all users activities in the database.
https://github.com/firoz-ahmad-likhon/codeigniter-audit-trail

audit-log audit-trail auditing codeigniter php user-audit-trail

Last synced: 3 months ago
JSON representation

CodeIgniter audit trail is a convenient way to track all users activities in the database.

Awesome Lists containing this project

README

        

# User Audit Trail #

It is an attempt to add user audit trail with CodeIgniter framework. I think it is a very convenient way to track user activities in the database.

### Installation ###

* Put all files into your projects directory respectively.
* Check config.php for $config['subclass_prefix'] this value. If it is not 'MY_' then rename MY_DB_mysqli_driver.php and MY_Loader.php to your value.
* To enable listening change set $config['audit_enable'] = TRUE in config/the trail.php
* You can start/stop to record insert, update, delete. please read carefully the trail.php

Now you are ready to browse the application.

### Database Table ###
* Run the sql in your database.

CREATE TABLE `user_audit_trails` (
`id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`event` enum('insert','update','delete') NOT NULL,
`table_name` varchar(128) NOT NULL,
`old_values` text,
`new_values` text NOT NULL,
`url` varchar(255) NOT NULL,
`name` varchar(128) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`user_agent` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


ALTER TABLE `user_audit_trails`
ADD PRIMARY KEY (`id`);

ALTER TABLE `user_audit_trails`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

### Further Work ###

Now it is your turn to make model and view for presenting the audit data. Happy coding..