PHP Report
PHP Report
CERTIFICATE
This is to certify that the Project report entitled ‘Discussion Board ’ was successfully
completed by students of Sixth semester Diploma in Computer Engineering under the course
PHP (22619).
3.Resources required
In acknowledgment of our college group project report, we extend our heartfelt gratitude to all
those who contributed to the successful completion of this endeavour. Firstly, we express our
sincere appreciation to our project supervisor, for their guidance, support, and invaluable insights
throughout the duration of the project. Their mentorship has been instrumental in shaping our
understanding and refining the project's scope. We would like to thank our fellow group members
for their collaborative spirit, dedication, and hard work. Each team member brought a unique set
of skills and perspectives, contributing to the our gratitude extends to the college faculty and staff
who provided resources, facilities, and a conducive learning environment. Their commitment to
fostering academic excellence has been pivotal in our academic journey. Finally, we
acknowledge the support of our friends and family for their encouragement and understanding
during the demanding phases of this project.
INTRODUCTION
A Discussion Board is a web-based platform that enables users to engage in online discussions
by posting topics, sharing opinions, and interacting with others through comments. This project is
developed using PHP, MySQL, HTML, CSS, and JavaScript, making it a dynamic and
interactive application.
The primary objective of this project is to facilitate seamless communication and collaboration
among users in an organized manner. Users can register, log in, create discussion threads, and
respond to existing posts. The system ensures structured data storage and retrieval using MySQL,
while PHP handles server-side processing. Additionally, authentication mechanisms are
implemented to secure user access and maintain a safe discussion environment.
This project serves as a valuable learning experience in full-stack web development, database
management, and user authentication while promoting efficient online interactions. It can be
further enhanced with features like moderation controls, file attachments, and notifications to
improve usability and engagement.
OBJECTIVE:
1. Facilitate Online Discussions – Provide a platform for users to create, share, and engage
in discussions on various topics.
2. User Authentication & Security – Implement login and registration features to ensure
secure access and prevent unauthorized participation.
3. Database Management – Store and manage user data, discussion posts, and comments
efficiently using MySQL.
4. Enhance User Interaction – Enable users to post, reply, and interact with discussions in
an organized manner.
5. Improve Web Development Skills – Apply PHP, HTML, CSS, and JavaScript to build a
functional and dynamic web application.
6. Ensure Accessibility & Usability – Design a user-friendly interface that allows easy
navigation and participation.
ADVANTAGES:
DISADVANTAGES:
1. Spam & Moderation Issues – Without proper moderation, discussions may become
cluttered with spam or inappropriate content.
2. Database Overload – If not optimized, a high number of users and posts may slow down
performance.
3. Limited Real-Time Interaction – Unlike chat applications, responses are not instant.
4. Security Concerns – If not properly secured, the system may be vulnerable to hacking or
data breaches.
5. Dependency on Internet Connectivity – Requires an internet connection for access,
limiting offline usability.
6. Requires Maintenance – Needs regular updates and security patches to ensure smooth
operation.
CODE
<?php
session_start();
include("../common/db.php");
if (isset($_POST['signup'])) {
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$address = $_POST['address'];
(`id`,`username`,`email`,`password`,`address`)
values(NULL,'$username','$email','$password','$address')");
$result = $user->execute();
$user->insert_id;
if ($result) {
$_SESSION["user"] = ["username" => $username, "email" => $email, "user_id" => $user-
>insert_id];
header("location: /MY-Projects-PHP-MYSQL/Discussion-Board/");
} else {
} else if (isset($_POST['login'])) {
$email = $_POST['email'];
$password = $_POST['password'];
$username="";
$user_id = 0;
$result = $conn->query($query);
if ($result->num_rows == 1) {
$username = $row['username'];
$user_id = $row['id'];
header("location: /MY-Projects-PHP-MYSQL/Discussion-Board/");
} else {
} else if (isset($_GET['logout'])){
session_unset();
header("location: /MY-Projects-PHP-MYSQL/Discussion-Board/");
} else if(isset($_POST['ask'])){
$title = $_POST['title'];
$description = $_POST['description'];
$category_id = $_POST['category'];
$user_id = $_SESSION['user']['user_id'];
(`id`,`title`,`description`,`category_id`,`user_id`)
values(NULL,'$title','$description','$category_id','$user_id')");
$result = $question->execute();
$question->insert_id;
if ($result) {
header("location: /MY-Projects-PHP-MYSQL/Discussion-Board/");
} else {
}else if(isset($_POST["answer"])){
$answer = $_POST['answer'];
$question_id = $_POST['question_id'];
$user_id = $_SESSION['user']['user_id'];
(`id`,`answer`,`question_id`,`user_id`) values(NULL,'$answer','$question_id','$user_id')");
$result = $query->execute();
if ($result) {
header("location: /MY-Projects-PHP-MYSQL/Discussion-Board?q-id=$question_id");
} else {
}else if(isset($_GET["delete"])){
$result = $query->execute();
if($result){
header("location: /MY-Projects-PHP-MYSQL/Discussion-Board");
}else{
?>
Db.php
<?php
$host="localhost";
$username="root";
$password=null;
$database="discussionboard";
$conn=new mysqli($host,$username,$password,$database);
if ($conn->connect_error){
?>
OUTPUT
CONCLUSION
The Discussion Board project in PHP successfully provides an interactive platform for users
to share ideas, engage in discussions, and exchange information efficiently. By utilizing PHP
for backend logic, MySQL for data storage, and HTML, CSS, and JavaScript for the
frontend, the project ensures a dynamic and user-friendly experience.
Key features such as user authentication, post creation, commenting, and real-time updates
contribute to an engaging environment for discussions. Security measures like input
validation and SQL injection prevention have also been implemented to enhance reliability.
Overall, this project demonstrates the effective use of PHP in web development and can be
further enhanced with features like real-time notifications, multimedia support, and an
improved UI/UX. Future improvements could also include integrating modern frameworks
for better scalability and performance.