School Management System Project With | Source Code In Php
// Fetch recent attendance $attendance = mysqli_query($conn, "SELECT date, status FROM attendance WHERE student_id=$student_id ORDER BY date DESC LIMIT 10");
if (mysqli_num_rows($result) == 1) { $user = mysqli_fetch_assoc($result); if (password_verify($password, $user['password'])) { $_SESSION['user_id'] = $user['id']; $_SESSION['role'] = $user['role']; $_SESSION['related_id'] = $user['related_id']; switch ($user['role']) { case 'admin': header("Location: admin/dashboard.php"); break; case 'teacher': header("Location: teacher/dashboard.php"); break; case 'student': header("Location: student/dashboard.php"); break; } } else { $error = "Invalid password"; } } else { $error = "User not found"; } } ?> <!-- HTML Form --> <form method="POST"> <input type="text" name="username" required> <input type="password" name="password" required> <button type="submit">Login</button> <?php if(isset($error)) echo "<p>$error</p>"; ?> </form> <?php require_once '../config/db_connection.php'; require_once '../includes/auth.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $roll_no = $_POST['roll_no']; $class_id = $_POST['class_id']; $section = $_POST['section']; $parent_mobile = $_POST['parent_mobile']; $address = $_POST['address']; $dob = $_POST['dob']; $admission_date = $_POST['admission_date']; school management system project with source code in php
$query = "INSERT INTO students (first_name, last_name, roll_no, class_id, section, parent_mobile, address, dob, admission_date) VALUES ('$first_name', '$last_name', '$roll_no', $class_id, '$section', '$parent_mobile', '$address', '$dob', '$admission_date')"; $user['password'])) { $_SESSION['user_id'] = $user['id']
// Fetch student details $student = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM students WHERE id=$student_id")); $_SESSION['role'] = $user['role']
// Fetch marks $marks = mysqli_query($conn, "SELECT m.exam_type, s.subject_name, m.marks_obtained, m.max_marks FROM marks m JOIN subjects s ON m.subject_id = s.id WHERE m.student_id=$student_id"); ?> <h1>Welcome, <?= $student['first_name'] ?></h1> <h3>Recent Attendance</h3> <ul> <?php while($row = mysqli_fetch_assoc($attendance)): ?> <li><?= $row['date'] ?> - <?= $row['status'] ?></li> <?php endwhile; ?> </ul>
1. Introduction A School Management System automates daily administrative tasks like student registration, attendance tracking, grade management, fee collection, and teacher assignment.