Skip to content

shayan041ir/task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CI3 User Management System

A complete user management system built with CodeIgniter 3 framework that includes authentication, authorization, and user administration features with DataTables integration.

πŸš€ Features

  • βœ… 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

πŸ“‹ Table of Contents

Installation

Prerequisites

  • PHP 5.6 or higher
  • MySQL 5.7 or higher
  • Web server (Apache/Nginx)
  • Composer (optional for dependency management)

Steps

  1. Clone or download the repository to your web server directory
git clone https://github.com/your-username/ci3-user-management.git
  1. Navigate to the project directory
cd ci3-user-management
  1. Install dependencies (if using Composer)
composer install

Database Setup

Create the database

CREATE DATABASE task CHARACTER SET utf8 COLLATE utf8_general_ci;

Create the users table

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;

Create an initial admin user

INSERT INTO users (name, email, password, role)
VALUES ('Admin User', '[email protected]', '$2y$10$...', 'admin');

Note: Use BCRYPT to hash the password before inserting.

Configuration

Database Configuration

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
);

URL Configuration

Edit application/config/config.php to set your base URL:

$config['base_url'] = 'http://localhost/task/';

Usage

Accessing the System

  1. Open your browser and go to: http://localhost/task
  2. Use the default admin credentials to log in
  3. Access the user management panel under "Admin" section

Default Routes

  • / - Login page (default controller)
  • /register - User registration
  • /login - Login page
  • /logout - Logout
  • /profile - User profile
  • /admin/users - User management panel

Admin Panel Features

  • 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

Project Structure

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

Security Features

Authentication

  • Secure password hashing with BCRYPT
  • Session-based authentication
  • Role-based access control
  • Secure password verification

Access Control

  • Admin-only access to user management
  • Prevention of self-deletion by admin
  • AJAX request validation
  • CSRF protection (if enabled)

Input Validation

  • Server-side validation with Form Validation library
  • Email uniqueness check
  • Password strength validation
  • XSS protection with input filtering

API Endpoints

DataTables API

  • GET /admin/users/list - Retrieve users in JSON format for DataTables

User Management API

  • POST /admin/users/create - Create new user
  • POST /admin/users/edit/{id} - Update user by ID
  • GET /admin/users/edit/{id} - Get user data for editing
  • POST /admin/users/delete/{id} - Delete user by ID

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and development questions:


Project Version: 1.0
Framework: CodeIgniter 3
Created: 2025

About

dade tejarat task

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published