Phpfinal
Phpfinal
Computer Engineering
BY:-
Ms. V. B. Maskar
SVERI’S
COLLEGE OF ENGINEERING (POLY),
PANDHARPUR 2024-25
1
CERTIFICATE
Submitted by:
Examiner Principal
(Prof. ) (Prof. Dr. N. D. Misal)
Place: Pandharpur
Date:
2
Annexure II
Evolution sheet for Micro Project
Academic Year: - 2024-25 Name of Faculty: -Ms. V. B. Maskar
Course: - Computer Engineering Course Code: - CO6I
Subject: -Web Based Application Development Subject Code: -22619
With PHP
Semester:- 6th Scheme: - I
Title of Online Examination System
Project: -
COs addressed by the Micro Project:
CO4 Use form controls with validation to collect user’s input.
(b) Unit Outcomes in 4a. Use the relevant form controls to get user’s input.
Cognitive domain: 4e. Manage the given session using session variables.
5a. Create database for the given problem using PHP script.
Marks out of
Marks out
6 for Total marks out
of 4 for
Roll No Name of student performance of 10
performance in
ingroup
activity oral/Presentation
3
ACKNOWLEDGEMENT
I take this opportunity to express my sincere thanks and deep sense of gratitude to my
guide, Ms. V. B. Maskar Madam for her constant support, motivation, valuable guidance and
immense help during the entire course of this work. Without her constant encouragement, timely
advice and valuable discussion, it would have been difficult in completing this work. I would also
like to acknowledge the Computer Engineering department who provided me the facilities for
completion of the project. We are thankful to her for sharing her experience in the research field
with me and providing constant motivation during entire project work.
Name of Student:-
4
Railway Reservation App
1 . Rationale:
The Online Examination System, developed using PHP, provides an efficient platform for
conducting tests and managing questions. It consists of two main pages: the first page displays
test questions for users, while the second page shows results, including correct and incorrect
answers. An admin panel, accessible via login, allows authorized users to add or delete
questions, ensuring secure management. All data is stored in a database for efficient handling.
This system simplifies online testing, offering a user-friendly experience for both test-takers and
administrators.
The aim of the Online Examination System is to provide an efficient, user-friendly, and secure
platform for conducting tests, evaluating user responses, and managing test questions. It
automates the examination process, ensuring accuracy, accessibility, and ease of administration.
Benefits:
a. Reduces manual effort and paper usage.
b. Automated evaluation with correct and incorrect answers.
c. Users can take tests anytime, anywhere.
4. .Literature Review:
The Online Examination System has evolved as a modern solution to replace traditional paper-
based exams, offering automated question delivery, evaluation, and result analysis. Studies
highlight its efficiency in reducing administrative workload, ensuring instant feedback, and
improving accuracy by minimizing human errors in grading. Secure authentication mechanisms
restrict question management to authorized admins, preventing unauthorized modifications.
Additionally, database integration enhances systematic storage and retrieval of questions and
results, ensuring data integrity. Overall, research supports online examination systems as a
reliable, accessible, and efficient method for conducting assessments.
5
5. Actual Methodology Followed:
a. index.php:
<?php
session_start();
try {
$db = new mysqli('localhost', 'root', 'root', 'online_test');
if ($db->connect_error) {throw new Exception("Connection failed: " . $db->connect_error);
}
$db->query("CREATE TABLE IF NOT EXISTS admins(id INT AUTO_INCREMENT
PRIMARY KEY, username VARCHAR(50) UNIQUE NOT NULL, password_hash VARCHAR(255)
NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )");
if ($result->num_rows === 1) {
$admin = $result->fetch_assoc();
if (password_verify($password, $admin['password_hash'])) {
$_SESSION['admin_logged_in'] = true;
$_SESSION['admin_id'] = $admin['id'];
} else {
$login_error = "Invalid username or password";
}
} else {
$login_error = "Invalid username or password";
}
}
if ($db->query($sql)) {
$message = "Question added successfully!";
$message_type = "success";
} else {
$message = "Error: " . $db->error;
$message_type = "error";
}
}
if ($db->query($sql)) {
$message = "Question deleted successfully!";
$message_type = "success";
} else {
$message = "Error deleting question: " . $db->error;
$message_type = "error";
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Online Test System</title>
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap
" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.4.0/css/all.min.css">
</head>
<body>
<div class="floating-shapes">
<div class="shape shape-1"></div>
<div class="shape shape-2"></div>
<div class="shape shape-3"></div>
</div>
<div class="container">
<div class="header">
<div class="header-bg"></div>
<div class="header-bg"></div>
<h1>Online Examination System</h1>
<p>Test your knowledge and track your progress with our comprehensive assessment
platform</p>
</div>
<div class="tabs">
<div class="tab active" onclick="openTab('take-test')">
<i class="fas fa-pencil-alt"></i> Take Test
</div>
<div class="tab" onclick="openTab('manage-questions')">
<i class="fas fa-cog"></i> Manage Questions
</div>
</div>
6
<!-- Take Test Tab -->
<div id="take-test" class="tab-content active">
<form id="test-form" action="process.php" method="post" onsubmit="return
validateTestForm()">
<div class="form-group">
<label for="name"><i class="fas fa-user"></i> Full Name</label>
<input type="text" id="name" name="name" class="form-control" placeholder="Enter
your full name" required>
</div>
<div class="form-group">
<label for="enrollment"><i class="fas fa-id-card"></i> Enrollment Number</label>
<input type="text" id="enrollment" name="enrollment" class="form-control"
placeholder="Enter your enrollment number" required>
</div>
<h3 style="margin: 35px 0 25px; color: var(--primary); font-weight: 600; display: flex;
align-items: center;">
<i class="fas fa-question-circle" style="margin-right: 12px;"></i> Test Questions
</h3>
<div class="form-group">
<label for="option_a"><i class="fas fa-list-ol"></i> Option A</label>
<input type="text" id="option_a" name="option_a" class="form-control" required>
</div>
<div class="form-group">
<label for="option_b"><i class="fas fa-list-ol"></i> Option B</label>
<input type="text" id="option_b" name="option_b" class="form-control" required>
</div>
<div class="form-group">
<label for="option_c"><i class="fas fa-list-ol"></i> Option C</label>
<input type="text" id="option_c" name="option_c" class="form-control" required>
</div>
<div class="form-group">
<label for="option_d"><i class="fas fa-list-ol"></i> Option D</label>
<input type="text" id="option_d" name="option_d" class="form-control" required>
</div>
<div class="form-group">
<label><i class="fas fa-check-circle"></i> Correct Answer</label>
<div class="radio-group">
<div class="radio-option">
<input type="radio" name="correct_answer" value="A" id="correct_a" required>
<label for="correct_a">Option A</label>
</div>
<div class="radio-option">
<input type="radio" name="correct_answer" value="B" id="correct_b">
<label for="correct_b">Option B</label>
</div>
<div class="radio-option">
<input type="radio" name="correct_answer" value="C" id="correct_c">
<label for="correct_c">Option C</label>
</div>
<div class="radio-option">
<input type="radio" name="correct_answer" value="D" id="correct_d">
<label for="correct_d">Option D</label>
6
</div>
</div>
</div>
<h2 style="color: var(--primary); margin: 45px 0 25px; display: flex; align-items: center;">
<i class="fas fa-list" style="margin-right: 12px;"></i> Existing Questions
</h2>
<script>
function openTab(tabName) {
// Hide all tab contents
const tabContents = document.getElementsByClassName('tab-content');
for (let i = 0; i < tabContents.length; i++) {
6
tabContents[i].classList.remove('active');
}
function confirmLogout() {
document.getElementById('logout-confirmation').style.display = 'flex';
}
function confirmDelete(questionId) {
document.getElementById('delete-confirmation').style.display = 'flex';
document.getElementById('confirm-delete-btn').href = `?delete_question=${questionId}`;
}
function closeDialog(dialogId) {
document.getElementById(dialogId).style.display = 'none';
}
function validateTestForm() {
const form = document.getElementById('test-form');
const questions = document.querySelectorAll('.question');
let allAnswered = true;
questions.forEach(question => {
const inputs = question.querySelectorAll('input[type="radio"]');
let answered = false;
inputs.forEach(input => {
if (input.checked) answered = true;
});
6
if (!answered) {
question.style.borderLeftColor = 'var(--danger)';
question.style.animation = 'shake 0.5s';
allAnswered = false;
if (!allAnswered) {
alert('Please answer all questions before submitting.');
return false;
}
return true;
}
b.process.php:
<?php
$db = new mysqli('localhost', 'root', 'root', 'online_test');
if ($db->connect_error) {
die("Connection failed: " . $db->connect_error);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = htmlspecialchars($_POST["name"]);
$enrollment = htmlspecialchars($_POST["enrollment"]);
$answers = $_POST["answers"];
$questions = [];
$result = $db->query("SELECT * FROM questions ORDER BY id");
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$questions[$row['id']] = $row;
}
}
$score = 0;
$total_questions = count($questions);
foreach ($questions as $question_id => $question_data) {
if (isset($answers[$question_id]) && $answers[$question_id] == $question_data["correct_answer"])
{
$score++;
}
}
$stmt = $db->prepare("INSERT INTO test_results (student_name, enrollment_number, score,
total_questions) VALUES (?, ?, ?, ?)");
6
$stmt->bind_param("ssii", $name, $enrollment, $score, $total_questions);
$stmt->execute();
$stmt->close();
$db->close();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Results</title>
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.4.0/css/all.min.css">
</head>
<body>
<div class="floating-shapes">
<div class="shape shape-1"></div>
<div class="shape shape-2"></div>
<div class="shape shape-3"></div>
</div>
<div class="container">
<div class="header">
<h1>Test Results</h1>
<p>Your detailed performance analysis and test results</p>
</div>
<div class="score-display">
<h2>Your Final Score</h2>
<div class="performance-meter">
<svg class="performance-circle" viewBox="0 0 200 200">
<circle class="performance-circle-bg" cx="100" cy="100" r="90"></circle>
<circle class="performance-circle-fill" cx="100" cy="100" r="90"></circle>
</svg>
<div class="performance-text">
<div class="performance-percent"><?php echo round(($score / $total_questions) * 100);
?>%</div>
<div class="performance-label">Score</div>
</div>
</div>
<div class="badge-container">
<div>
<div class="badge">
<i class="fas fa-medal"></i>
</div>
<div class="badge-label">Achievement</div>
</div>
<div>
<div class="badge">
<i class="fas fa-star"></i>
</div>
<div class="badge-label">Performance</div>
</div>
<div>
<div class="badge">
<i class="fas fa-trophy"></i>
</div>
<div class="badge-label">Rank</div>
</div>
</div>
</div>
<div class="user-info">
<div class="info-card">
<h3>Student Name</h3>
<p><?php echo $name; ?></p>
</div>
<div class="info-card">
<h3>Enrollment Number</h3>
<p><?php echo $enrollment; ?></p>
</div>
<div class="info-card">
<h3>Submission Date</h3>
<p><?php echo date('F j, Y, g:i a'); ?></p>
</div>
</div>
<div class="results-section">
<h2>Detailed Question Analysis</h2>
<script>
// Animate progress bar on page load
document.addEventListener('DOMContentLoaded', function() {
6
const progressBar = document.querySelector('.progress-bar');
const computedWidth = progressBar.style.width;
progressBar.style.width = '0';
setTimeout(() => {
progressBar.style.width = computedWidth;
}, 100);
6
6. Features :
7. Technical Specifications:
The Online Examination System provides a simple and intuitive user interface, allowing users to
navigate between the test and results pages. On the first page, users are presented with multiple-
choice questions (MCQs) to answer. Once the test is submitted, the system automatically evaluates
the responses based on the correct answers stored in the database. The second page displays the
results in real-time, showing which questions were answered correctly or incorrectly along with the
correct answers for reference. A secure admin panel enables authorized administrators to log in and
manage test questions by adding, updating, or deleting them. All test data, including questions, user
responses, and results, is stored in a MySQL database for efficient retrieval and management. The
system ensures security through authentication, allowing only admins to modify questions while
keeping user responses and results protected. Users can attempt the test multiple times without
restrictions, and real-time processing provides instant feedback after submission.
23
9. Future developments:
10. Advantages:
11. Disadvantages:
24
12. Actual Output:
25
26
13. Actual Resource Used:
This project helped us develop essential skills in web development using PHP, including
designing user-friendly interfaces, managing a MySQL database for storing questions, user
responses, and results, and handling data processing between pages. We improved our UI/UX
design, implemented an admin panel for secure question management, and developed features
for automated evaluation and instant result display. Throughout the project, we enhanced our
problem-solving abilities and learned the importance of writing clean, efficient, and well-
structured code to ensure a seamless user experience.
27
16. Conclusion:
The Online Examination System provides an efficient and automated platform for
conducting tests. It ensures instant result evaluation and simplifies exam management. A
secure admin panel allows authorized question management. Database integration ensures
efficient data storage and retrieval. Real-time processing enhances user experience with quick
feedback. The system is scalable and flexible for various applications. This project improved
our web development and problem-solving skills.
17. References:
1. https://www.geeksforgeeks.org/php-database-connection/
2. https://www.w3schools.com/php/php_mysql_connect.asp
3. https://mailtrap.io/blog/php-form-validation/
4. https://www.sitepoint.com/form-validation-with-php/
28
29
30
19
20
21
12. Actual Resource Used:
This micro-project helped us develop essential skills in Android app development, including
creating user-friendly interfaces using Java and XML, managing an SQLite database for storing
train details and bookings, and handling data transfer between activities. We improved our
UI/UX design, integrated libraries for better functionality, and implemented features for train
management and ticket booking. Along the way, we enhanced our problem-solving abilities and
learned the importance of writing clean, efficient, and well-structured code to ensure a smooth
user experience.
22
15. The Railway Reservation Conclusion:
App provides a simple and efficient solution for managing train reservations. By integrating train
search, ticket booking, and reservation management, the app enhances user convenience and
streamlines the booking process. Using SQLite for data storage, it ensures offline accessibility
while maintaining a user-friendly interface for seamless navigation. Through this project, we
gained valuable insights into Android app development, database management, and UI/UX design.
This application can be further enhanced with features like real-time train tracking, payment
integration, and automated seat availability updates, making it even more functional and user-
centric.
16. References:
a. https://www.irctc.co.in
b. https://www.makemytrip.com
c. https://www.redbus.in
23