Welcome Guest, Not a member yet? Register   Sign In
Restricting access to specific functions in controllers

A while back on a project since gone and over with I recall being able to restrict access to specific functions within my controller. For instance, I would create callback functions for form validation. Obviously, these functions serve no other purpose than to be called during the form validation, so having users type in the url to the function (ie base_url/controller/callback_function) is not needed and if at all possible, I'd like to prevent this.

I seem to remember being able to add an access modifier to the function to prevent direct access to those functions, but I cannot seem to replicate this. Can someone please enlighten me on the best practices of preventing direct browser access to specific functions?

i think the modifier is "_", like this :

function function_with_direct_access()
function _function_without_direct_access()

That seems to have done the trick! Thanks much for your assistance!

add 'private' to your method or '_' if in php4

That's the problem though, I would add private to my methods, and I would receive errors... Hence the confusion, as that is what I thought I did before...

Theme © iAndrew 2016 - Forum software by © MyBB