Welcome Guest, Not a member yet? Register   Sign In
Filter/Session Issue
#3

(This post was last modified: 01-21-2024, 04:21 PM by jsurp2001.)

(01-21-2024, 10:28 AM)InsiteFX Wrote: Can you show us your filter code?

Here is the dashboard filter:
Code:
<?php

namespace App\Filters;

use App\Models\AuthModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Filters\FilterInterface;

class Dashboard implements FilterInterface
{
    public function before(RequestInterface $request, $arguments = null)
    {
        $AuthModel = new AuthModel();

        helper(['user']);

        if(!session('dashboard'))
        {
            log_user_activity('filter-not-dashboard-user', 'Attempted to access <b>dashboard</b>.<br/>Redirected to home page.');
            return redirect()->with('session_alert', 'warning|Unauthorized Area!|You do not have authorization to access the previous area.')->to(site_url());
        }
    }

    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
    {

    }
}
Here is the developer filter:
Code:
<?php

namespace App\Filters;

use App\Models\AuthModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Filters\FilterInterface;

class Developer implements FilterInterface
{
    public function before(RequestInterface $request, $arguments = null)
    {
        $AuthModel = new AuthModel();

        helper(['user']);

        if(!session('developer'))
        {
            log_user_activity('filter-not-developer', 'Attempted to access <b>developer</b> area.<br/>Redirected to dashboard.');
            return redirect()->with('session_alert', 'warning|Unauthorized Area!|You do not have authorization to access the previous area.')->to(site_url('dashboard'));
        }
    }

    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
    {

    }
}

Once the filter sends me to the dashboard, I am still able to see the session data. My filters have been working fine for months, I'm not sure what is going on. And now my admin filter is kicking me to the dashboard. Thank you!!

1/21/2023 @ 1:14pm: I have also tried commenting out the code, leaving a completely blank method, and nothing, no session data when the page loads which is strange because you would think that my other filter, before that one which determines if the user is logged in, would send me to the login page.

1/21/2023 @ 4:10pm: I just noticed that there are 2 ci_session cookies:
https://drive.google.com/uc?export=view&...A9LH_kRQur
Reply


Messages In This Thread
Filter/Session Issue - by jsurp2001 - 01-21-2024, 06:53 AM
RE: Filter/Session Issue - by InsiteFX - 01-21-2024, 10:28 AM
RE: Filter/Session Issue - by jsurp2001 - 01-21-2024, 10:41 AM
RE: Filter/Session Issue - by InsiteFX - 01-21-2024, 11:02 PM
RE: Filter/Session Issue - by jsurp2001 - 01-22-2024, 04:22 AM
RE: Filter/Session Issue - by InsiteFX - 01-22-2024, 06:10 AM
RE: Filter/Session Issue - by jsurp2001 - 01-22-2024, 09:06 AM
RE: Filter/Session Issue - by virtualgadjo - 03-14-2024, 06:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB