Welcome Guest, Not a member yet? Register   Sign In
Filter controller without authentication
#9

(This post was last modified: 08-28-2020, 01:52 AM by pippuccio76.)

(08-27-2020, 04:18 AM)Chroma Wrote: When I was doing this, I had an exclusion list that would be checked first, if the controller/method was in the exclusion list, the filter was finished and processing stopped.

Something like this...

PHP Code:
        $current = (string)current_url(true)->setHost('')->setScheme('')->stripQuery('token');

        // the array must be all methods that do NOT require being checked
        if (in_array((string)$current, ['/controller/method1''/controller/method2']))
        {
            return;
        


Put any must do filter code after this snippet. It will then exit if necessary or allow the processing as necessary.

You can of course add as many controller/method items to the exclusion array.



Codeigniter 4 have except to remove some uri to filter , i want know how use it ,principally i want know how use filter for every method of a controller without write a row for every method (if it's possible) than i want exclude the filter for some method ....
Reply


Messages In This Thread
RE: Filter controller without authentication - by pippuccio76 - 08-28-2020, 01:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB