CodeIgniter Forums
CI4 - ROUTES - FILTER PROBLEM - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: CI4 - ROUTES - FILTER PROBLEM (/showthread.php?tid=77843)



CI4 - ROUTES - FILTER PROBLEM - shashi - 10-26-2020

Hello Everyone,

I am using CI 4.0.4
XAMPP CONTROL 3.2.4

I AM USING CI 4.0.4 FOR MY ONGOING LIVE PROJECT

CURRENTLY I AM FACING SOME ISSUE

MY WEBSITE URL : http://localhost/shashi/public/   , i am not using spark

I HAVE CREATED A  CONTROLLER

Code:
<?php namespace App\Controllers;

class Dashboard extends BaseController
{
    public function index()
    {
        $data = [];

        echo view('templates/header', $data);
        echo view('dashboard');
        echo view('templates/footer');
    }

    //--------------------------------------------------------------------

    public function addsystemprice()
    {
        $data = [];

        echo view('templates/header', $data);
        echo view('addsystem');
        echo view('templates/footer');
    }

}

In App\Routes:

Code:
$routes->group('dash',['filter' => 'auth'], function($routes) {
    $routes->get('dashboard', 'Dashboard::index',['namespace' => 'App\Controllers\Dash']);
    $routes->get('adddash', 'Dashboard::addsystemprice',['namespace' => 'App\Controllers\Dash']);
});


Now when  i open :

http://localhost/shashi/public/dash/dashboard
http://localhost/shashi/public/dash/adddash

page opens and filter -> auth ( session check for login user ) also work  - as i check in 2 bowers

but suppose i open

http://localhost/shashi/public/dash/dashboard/addsystemprice

page open , but why filter is not working ??

as it already route to http://localhost/shashi/public/dash/adddash

any thing missing ?

if some one can get my controller/methods name - then he/she can open the page and do the wrong stuff - as filter is not working which has session check for login user

please let me know


RE: CI4 - ROUTES - FILTER PROBLEM - shashi - 10-26-2020

any one ??


RE: CI4 - ROUTES - FILTER PROBLEM - tgix - 10-27-2020

CI auto-routes for you - see https://codeigniter4.github.io/userguide/incoming/routing.html#use-defined-routes-only
You should never have this setting enabled in production.


RE: CI4 - ROUTES - FILTER PROBLEM - shashi - 10-28-2020

(10-27-2020, 01:09 PM)tgix Wrote: CI auto-routes for you - see https://codeigniter4.github.io/userguide/incoming/routing.html#use-defined-routes-only
You should never have this setting enabled in production.
 

 i am extremely thankful

 5/5

 at-least you reply


 i think  user-guide  should be more simple with more examples

 thanks again


RE: CI4 - ROUTES - FILTER PROBLEM - tgix - 10-28-2020

Please remember that this is a community forum providing user-to-user support.


RE: CI4 - ROUTES - FILTER PROBLEM - shashi - 10-28-2020

(10-28-2020, 01:19 AM)tgix Wrote: Please remember that this is a community forum providing user-to-user support.
 
ok

thanks