php - Making a function undefined when called by url -
Using Codeigniter, I call [my controller] a public function from the URL which is basically the general behavior of the framework. I am passing 3 criteria as
$ a, $ b, $ c and when the function is executed, it checks the parameters and goes according to it Now, the problem is that I do not Wish that my function should be called by URL, when it is said it should go to 404 page. I know that it can be obtained by adding private or protected , but the real problem is that it is only through one of its own functions Should go and not directly by the URL . Any solutions are welcome. The HTTP path block works but when I pass the parameter, the function is executed which is a security problem. How to block access to any idea?
You can use routing to block any of the http traffic that controller / method And redirect to the 404 page.
In your routes.php file in the Config folder, add the following $ route ['controller / private_method'] = '{your 404 Controller} '; $ Route ['admin / private_math / (: any)'] = '{404 controller}'; The second rule caters for any criteria.
Comments
Post a Comment