A complete Blog Management System built using PHP and MySQL, featuring user authentication, blog CRUD operations, dashboard management, and email notifications.
This project demonstrates real-world backend workflows commonly used in PHP-based web applications.
- User registration and login
- Secure session-based authentication
- Blog creation, update, and deletion
- Dashboard for managing blogs
- Email notification using PHPMailer
- File upload support
- Database-driven application
- PHP
- MySQL
- PHPMailer
- Composer
- HTML
- CSS
- Bootstrap
- XAMPP (Local Development)
index.php– Homepage / Blog listingregister.php– User registrationlogin.php– User authenticationdashboard.php– User dashboardcreateBlog.php– Create blog postupdateBlog.php– Update blog postdeleteBlog.php– Delete blog postdatabase.php– Database connectionprocess.php– Email processingvendor/– Composer dependencies
if (isset($_POST['register'])) {
$name = $_POST['fullname'];
$email = $_POST['email'];
$pass = password_hash($_POST['password'], PASSWORD_DEFAULT);
$query = "INSERT INTO users (fullname, email, password) VALUES ('$name', '$email', '$pass')";
mysqli_query($conn, $query);
}session_start();
if (password_verify($password, $user['password'])) {
$_SESSION['id'] = $user['id'];
$_SESSION['email'] = $user['email'];
header("Location: dashboard.php");
exit;
}session_start();
if (!isset($_SESSION['id'])) {
header("Location: login.php");
exit;
}✔ Ensures only authenticated users can access the dashboard.
$query = "DELETE FROM blogs WHERE id='$id'";
mysqli_query($conn, $query);$query = "DELETE FROM blogs WHERE id='$id'";
mysqli_query($conn, $query);PHPMailer is installed using Composer.
composer require phpmailer/phpmailerPHPMailer is installed using Composer.
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require "vendor/autoload.php";
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'your_email@gmail.com';
$mail->Password = 'your_app_password';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
$mail->setFrom('test@test.com', 'Blog System');
$mail->addAddress($email);
$mail->Subject = 'Blog Notification';
$mail->Body = 'Your blog has been published successfully';
$mail->send();- Building authentication systems in PHP
- Session management and access control
- CRUD operations with MySQL
- Integrating PHPMailer using Composer
- Structuring a real-world PHP project
- Writing maintainable backend logic
- This project is built for learning and practice purposes
- Uses local SMTP configuration for testing
- Can be improved by:
- Using prepared statements (SQL Injection prevention)
- Adding role-based access
- Implementing pagination
- Adding .env configuration for credentials
- PDO implementation
- Admin role management
- Comment system
- Email verification on registration
- Password reset functionality