CodeIgniter Forums
I do not want to allow access to a controller by url - 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: I do not want to allow access to a controller by url (/showthread.php?tid=40732)



I do not want to allow access to a controller by url - El Forum - 04-17-2011

[eluser]MrAmine[/eluser]
hi evryone
I do not want to allow access to a controller by url
how can i do


I do not want to allow access to a controller by url - El Forum - 04-17-2011

[eluser]mdvaldosta[/eluser]
Don't have an index function and prefix all your functions with an underscore.


I do not want to allow access to a controller by url - El Forum - 04-18-2011

[eluser]MrAmine[/eluser]
i don't understand ??


I do not want to allow access to a controller by url - El Forum - 04-18-2011

[eluser]eoinmcg[/eluser]
it's all in the manual:
http://ellislab.com/codeigniter/user-guide/general/controllers.html

the index() method is what CI will load if no method is specified in the url
eg http://example.com/my_app/blog
will execute the index method in the blog controller.

if there is no index method for the blog controller a '404 not found' error will be shown.

also prefixing your methods with an underscore means that they are private and not accessible by url.


I do not want to allow access to a controller by url - El Forum - 04-18-2011

[eluser]WanWizard[/eluser]
If you don't want access to the controller via the URL, what are you going to do with that controller then? Because in stock CI, you can't use controllers internally...


I do not want to allow access to a controller by url - El Forum - 04-18-2011

[eluser]InsiteFX[/eluser]
If its a specific controller like only for an admin then check to see if the logged in user is an admin if not redirect them back to the home page!

InsiteFX


I do not want to allow access to a controller by url - El Forum - 04-20-2011

[eluser]Nur Cholikul Anwar[/eluser]
Maybe you need a authentication programe