Welcome Guest, Not a member yet? Register   Sign In
Always show 404 with incorrect parameters?
#1

[eluser]Unknown[/eluser]
*** Edit: I already asked this last year. Figures. I can't see how to delete this. ***


If someone enters an incorrect controller name, my site properly shows my custom 404 page. However, only one of my controller's methods accepts a parameter. I would expect CodeIgniter to also generate a 404 if an unsupported number of parameters are passed to a method. For example, if the function is defined as:

Code:
public function something()

… then it seems any number of parameters can be passed via URL, even if it's not supported by the function. If I try:

Code:
http://site.com/controller/something/1/2/3/4/5/5

… it does not generate an error, the function is still called and the page loads. I don't want my visitors to think that's valid. If I try:

Code:
public do something(void)

… then I just get a white page no matter how many parameters are passed.

Like I said before, this particular controller has many functions, and only one that accepts a single optional parameter. Is there a way (via routs or something) to automatically handle validation of parameters?

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB