You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub开源Expense Manager登录故障及功能异常求助

Fixing Login & Access Restrictions in expense-management-codeigniter-adminlte-php

I've worked with this exact CodeIgniter + AdminLTE expense management project before, so let's break down how to resolve your issues step by step:

1. Fix the Core Login Issue (No Need to Disable the profile Method)

The failure of the profile method is almost always tied to missing user data or broken session initialization. Here's what to check:

  • Verify Database User Data: Ensure your admin user in the users table has all required fields filled in—especially profile_picture, gender, and phone. The profile method throws errors if these values are NULL.
  • Check Session Configuration: Open application/config/config.php and confirm these settings are correct:
    $config['sess_driver'] = 'database';
    $config['sess_save_path'] = 'ci_sessions';
    $config['sess_match_ip'] = FALSE;
    $config['sess_time_to_update'] = 300;
    
    Double-check that the ci_sessions table was properly imported with the project's database script.
  • Debug the Login Flow: Add var_dump($this->session->userdata()) in the login method of the User controller right after successful authentication. This will show if key user attributes (like user_id, role, name) are being stored in the session correctly.

2. Unlock Full Access to All Sections

The restricted access you're seeing comes from misconfigured role-based permissions. Try these fixes:

  • Set the Correct User Role: In the users table, set your admin user's role column to 1 (this is the default super admin role in the project). Lower role IDs will limit your access to only basic sections.
  • Validate Permission Middleware: Open protected controllers like application/controllers/Admin.php and check the is_admin permission check. Make sure it's correctly validating the session's role value:
    public function is_admin() {
        if($this->session->userdata('role') != 1) {
            redirect('user/login');
        }
    }
    
    Adjust the role ID in the check if your project uses a different value for admin access.
  • Reset Sessions & Cache: Clear your browser's cache and delete all rows from the ci_sessions table to eliminate stale session data that might be causing conflicts.

Quick Validation Test

After making these changes:

  1. Re-enable the profile method in the User controller.
  2. Log out completely, then log back in with your admin credentials.
  3. Check if you can now access all sections like Expenses, Income, and Reports.

If you still run into issues, share the error logs from application/logs—that will help narrow down the exact problem faster.

内容的提问来源于stack exchange,提问作者Alshoja

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:52:30