logging all user actions |
Hello just use a model that autoload, and have the function to set the logs, something like this:
On Logs_Model: public function set_log($action = FALSE, $extra = $FALSE) { $diccionario = array ( 1 => 'has loged in', 2 => 'has loged out' 3 => 'created'. $extra[0]. " " .$extra[1], ); $datestring = '%Y-%m-%d %h-%i-%s %a'; $log = array ( 'logs_date' => mdate($datestring, time()), 'logs_user'=>$this>session>userdata('username'), 'logs_event' => $diccionario[$action], ); $this->db->insert('logs', $log); } Supouse you will create an user, in your controller: ... $this->user_model->insert(); $extra = array( 'the user', $this->input->post('username'), ); $this->logs_model->set_log(3, $extra); |
Welcome Guest, Not a member yet? Register Sign In |