• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI4 - ROUTES - FILTER PROBLEM

#1
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
Reply

#2
any one ??
Reply

#3
CI auto-routes for you - see https://codeigniter4.github.io/userguide...outes-only
You should never have this setting enabled in production.
Reply

#4
(10-27-2020, 01:09 PM)tgix Wrote: CI auto-routes for you - see https://codeigniter4.github.io/userguide...outes-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
Reply

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

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

thanks
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.