Jump to content

Tutorial for creating a logging system?


Eiolon

Recommended Posts

Except he's looking for how to create a logging system, not a login system.

 

Really, it's not terribly difficult. You can either fire stuff out to a flat text file or store it in a DB.

 

Figure out what information you need to store and create a function:

 

_system_logger('alert_level', 'action_taken', 'by_user');

 

ex;

 

function _system_logger($level = 'NOTICE', $action, $user)
{
   $action_insert = array('level' => $level, 'action' => $action, 'user' => $user);
   $this->db->insert('system_logger', $action_insert);
}

 

Private function, only you will ever call it.. My above example relies on the ActiveRecord library included with CodeIgniter, but it gives you the idea of how it works. Just make a function that either does a fwrite() or mysql_query('insert into...');

 

:)

men your example maybe good but for a noob do you think it helps?

 

This is always being asked here. but I believe if you know how to connect and query using a scripting language(PHP) then you should be fine I suggest learn the basic before jumping to a complicated codes  learn how to <a href="http://www.w3schools.com/php/php_mysql_select.asp> query</a> mysql in php first

 

and study the use of <a href="http://www.php.net/manual/en/ref.session.php">session</a>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.