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...');

 

:)

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.