A complete user management system built with CodeIgniter 3 framework that includes authentication, authorization, and user administration features with DataTables integration.
- β User registration and authentication system
- β Role-based access control (Admin/User)
- β Admin panel for user management
- β DataTables with search, sort, and pagination
- β Full CRUD operations for users
- β Password security with BCRYPT hashing
- β Client and server-side validation
- β RTL support (Persian/Arabic interface ready)
- β Responsive design with Bootstrap 5
- Installation
- Database Setup
- Configuration
- Usage
- Project Structure
- Security Features
- API Endpoints
- Contributing
- License
- PHP 5.6 or higher
- MySQL 5.7 or higher
- Web server (Apache/Nginx)
- Composer (optional for dependency management)
- Clone or download the repository to your web server directory
git clone https://github.com/your-username/ci3-user-management.git- Navigate to the project directory
cd ci3-user-management- Install dependencies (if using Composer)
composer installCREATE DATABASE task CHARACTER SET utf8 COLLATE utf8_general_ci;CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL UNIQUE,
`password` varchar(255) NOT NULL,
`role` enum('user','admin') DEFAULT 'user',
`created_at` timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;INSERT INTO users (name, email, password, role)
VALUES ('Admin User', '[email protected]', '$2y$10$...', 'admin');Note: Use BCRYPT to hash the password before inserting.
Edit application/config/database.php with your database credentials:
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'your_username',
'password' => 'your_password',
'database' => 'task',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);Edit application/config/config.php to set your base URL:
$config['base_url'] = 'http://localhost/task/';- Open your browser and go to:
http://localhost/task - Use the default admin credentials to log in
- Access the user management panel under "Admin" section
/- Login page (default controller)/register- User registration/login- Login page/logout- Logout/profile- User profile/admin/users- User management panel
- View all users in a DataTable
- Add new users
- Edit existing users
- Delete users (with safety checks)
- Search and filter users
- Sort by different columns
task/
βββ application/ # Main application directory
β βββ config/ # Configuration files
β β βββ database.php # Database settings
β β βββ routes.php # URL routing
β β βββ ... # Other config files
β βββ controllers/ # Controller classes
β β βββ Auth.php # Authentication controller
β β βββ admin/
β β βββ Users.php # User management controller
β βββ models/ # Model classes
β β βββ User_model.php # User model
β βββ libraries/ # Custom libraries
β β βββ UserService.php # User service
β βββ views/ # View templates
β β βββ admin/ # Admin panel views
β β βββ auth/ # Authentication views
β β βββ templates/ # Shared templates
β βββ ...
βββ assets/ # CSS, JS, images
βββ system/ # CodeIgniter core
βββ index.php # Main entry point
βββ .htaccess # URL rewriting rules
- Secure password hashing with BCRYPT
- Session-based authentication
- Role-based access control
- Secure password verification
- Admin-only access to user management
- Prevention of self-deletion by admin
- AJAX request validation
- CSRF protection (if enabled)
- Server-side validation with Form Validation library
- Email uniqueness check
- Password strength validation
- XSS protection with input filtering
GET /admin/users/list- Retrieve users in JSON format for DataTables
POST /admin/users/create- Create new userPOST /admin/users/edit/{id}- Update user by IDGET /admin/users/edit/{id}- Get user data for editingPOST /admin/users/delete/{id}- Delete user by ID
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and development questions:
- CodeIgniter Forum: http://forum.codeigniter.com/
- GitHub Wiki: https://github.com/bcit-ci/CodeIgniter/wiki
- Slack: https://codeigniterchat.slack.com
Project Version: 1.0
Framework: CodeIgniter 3
Created: 2025