CodeIgniter Forums
Handle user abuse - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Handle user abuse (/showthread.php?tid=60971)



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

[eluser]olof84[/eluser]
How should I handle forbidden user actions in a CI project?

For example:
Code:
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

[eluser]CroNiX[/eluser]
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

[eluser]olof84[/eluser]
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.