Protecting certain functions in controller form being used by user directly |
[eluser]bleu[/eluser]
The are certain functions in my controllers that I do not want people to have access to. I may want only one main function to be accessed in that controller through the browser. The other functions should be accessed by that main function in that controller only How can I achieve that Example: controller/function1 should be able to be accessed by the browser other functions should be accessed by function1(i.e. function2,function3 should be accessed by function1)
[eluser]soupli[/eluser]
You could use the controllers _remap() function: http://ellislab.com/codeigniter/user-gui...#remapping or choose to use URI Routing: http://ellislab.com/codeigniter/user-gui...uting.html
[eluser]PhilTem[/eluser]
You could also use what is mentioned in the user's guide about private functions.
[eluser]InsiteFX[/eluser]
Code: function _name() // CI private
[eluser]bleu[/eluser]
[quote author="InsiteFX" date="1333366144"] Code: function _name() // CI private what is difference between ci private and php private?
[eluser]PhilTem[/eluser]
PHP private is private in terms of object visibility. CI private is only in terms of URI. Any method defined public but starting with an underscore won't be accessible by any user Code: public function _not_publicly_accessible() If you defined any method with visibility private/protected, it won't however be accessible by the CI super-object, too. But that's because it can't call Code: $controller->protected_method()
[eluser]bleu[/eluser]
[quote author="PhilTem" date="1333373638"]PHP private is private in terms of object visibility. CI private is only in terms of URI. Any method defined public but starting with an underscore won't be accessible by any user Code: public function _not_publicly_accessible() If you defined any method with visibility private/protected, it won't however be accessible by the CI super-object, too. But that's because it can't call Code: $controller->protected_method() Thanks |
Welcome Guest, Not a member yet? Register Sign In |