• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Handle user abuse

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.

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?

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.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.