CodeIgniter Forums
Handle user abuse - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Handle user abuse (/showthread.php?tid=60971)

Handle user abuse - El Forum - 08-15-2014

How should I handle forbidden user actions in a CI project?

For example:
try {
     if($action == 'forbidden')
          throw new exception('Forbidden action!');
} catch (Exception $e)
      show_error ($e->getMessage(), 500);

The example above will call the general_error.php site which has an static header text (in my case: 'Sorry an error happened'). This dose not seem like the best way to handle user abuse.

Further more the example above will not log the user abuse.

Handle user abuse - El Forum - 08-15-2014

If you don't like the way show_error works, create your own "page" to send your errors to. Just call a view and pass whatever data to display that you feel appropriate.

Is there a reason why you couldn't just use the db and log the error before you show it?

Handle user abuse - El Forum - 08-18-2014

Thanks. Sorry for my late answer; I almost forgot this thread.

Yeah you are probably true, I dont know why I did not think of that. I am quite the novice when it comes to error reporting, so I was curious how others managed user abuses.