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

[eluser]sjmiller85[/eluser]
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?
#2

[eluser]vitoco[/eluser]
i think the modifier is "_", like this :

function function_with_direct_access()
function _function_without_direct_access()
#3

[eluser]sjmiller85[/eluser]
That seems to have done the trick! Thanks much for your assistance!
#4

[eluser]rogierb[/eluser]
add 'private' to your method or '_' if in php4
#5

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