A simple PHP-based user portal that supports registration, login, profile management, and dashboard functionality. This project demonstrates basic user authentication, file upload, and session handling. A secure and well-structured PHP User Portal built with the MVC approach.
This project demonstrates best practices in:
- 📂 Organizing PHP code using Models for cleaner architecture
- 🔒 Secure database connection with PDO & prepared statements
- 👤 User registration, login, and profile management
- 📊 Simple dashboard for authenticated users
Ideal for developers learning PHP project structure or building real-world authentication systems.
- User Registration with profile image upload
- User Login & Logout
- Authenticated Dashboard
- AJAX-based interactions
- MySQL database integration
- Basic modular structure
- PHP (Core)
- MySQL
- JavaScript / AJAX
- HTML / CSS
- Bootstrap (if used in assets)
- jQuery (optional, based on usage)
user-portal/
│
├── index.php # Homepage (Redirect to login)
├── register.php # User registration form
├── login.php # Login logic
├── logout.php # Logout script
├── dashboard.php # Authenticated user dashboard
├── config.php # Database connection setup
├── auth_check.php # Session-based access control
├── ajax.php # AJAX endpoints (e.g., validation)
│
├── user_portal.sql # SQL dump for users table
│
├── /uploads/ # User-uploaded profile images
├── /assets/ # CSS, JS, or image files
├── /models/ # Model components
├── /db/ # Possibly DB interaction layer
git clone https://github.com/your-username/user-portal.git
cd user-portal
- Create a MySQL database (e.g.,
user_portal
) - Import
user_portal.sql
using phpMyAdmin or CLI:
mysql -u root -p user_portal < user_portal.sql
Edit the config.php
file with your DB credentials:
const DB_HOST = 'localhost';
const DB_NAME = 'user_portal'; // Database name if changed.
const DB_USER = 'YOUR_DB_USERNAME_HERE';
const DB_PASS = 'YOUR_DB_PASSWORD_HERE';
Use a local server like XAMPP, WAMP, or MAMP.
Place the folder in your htdocs
and access:
http://localhost/user-portal/
- Register a user
- Log in using the credentials
- Access
dashboard.php
- Test uploading a profile picture
- Use browser Dev Tools to view AJAX requests
If profile images fail to upload, make sure the /uploads
folder is writable:
sudo chmod -R 775 uploads/
sudo chown -R www-data:www-data uploads/
- Sachin Sanchania – @sachin-sanchania