57 lines
1.8 KiB
PHP
57 lines
1.8 KiB
PHP
|
<?php
|
||
|
require '../config/function.php';
|
||
|
|
||
|
if(isset($_POST['signaturestudent'])) {
|
||
|
|
||
|
if(strlen($_POST['signature']) > 1526) {
|
||
|
$id = validate($_POST['id']);
|
||
|
|
||
|
$signature = $_POST['signature'];
|
||
|
$student_id = $_POST['id'];
|
||
|
|
||
|
$query = "UPDATE tbl_students SET sig_student = '$signature', sig_student_time = NOW() WHERE id = '$id'";
|
||
|
$result = mysqli_query($conn, $query);
|
||
|
|
||
|
if($result) {
|
||
|
header("Location: signature-parent.php");
|
||
|
} else {
|
||
|
redirect('signature-student.php', 'Es ist ein Fehler aufgetreten.', 'danger');
|
||
|
}
|
||
|
} else {
|
||
|
redirect('signature-student.php', 'Das Feld darf nicht leer sein.', 'danger');
|
||
|
}
|
||
|
}
|
||
|
require('../assets/fpdf186/fpdf.php'); // Stellen Sie sicher, dass der Pfad zu Ihrem fpdf.php korrekt ist
|
||
|
|
||
|
if(isset($_POST['signatureparent'])) {
|
||
|
if(strlen($_POST['signature']) > 1526) {
|
||
|
$id = validate($_POST['id']);
|
||
|
|
||
|
$signature = $_POST['signature'];
|
||
|
$student_id = $_POST['id'];
|
||
|
|
||
|
// Update query to include the current timestamp for sig_parent_time
|
||
|
$query = "UPDATE tbl_students SET sig_parent = '$signature', sig_parent_time = NOW() WHERE id = '$id'";
|
||
|
$result = mysqli_query($conn, $query);
|
||
|
|
||
|
if($result) {
|
||
|
// Fetch the updated record to get the timestamp
|
||
|
$query = "SELECT sig_parent_time FROM tbl_students WHERE id = '$id'";
|
||
|
$result = mysqli_query($conn, $query);
|
||
|
$row = mysqli_fetch_assoc($result);
|
||
|
$timestamp = $row['sig_parent_time'];
|
||
|
|
||
|
|
||
|
header("Location: signature-completed.php");
|
||
|
} else {
|
||
|
redirect('signature-parent.php', 'Es ist ein Fehler aufgetreten.', 'danger');
|
||
|
}
|
||
|
} else {
|
||
|
redirect('signature-parent.php', 'Das Feld darf nicht leer sein.', 'danger');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
?>
|
||
|
|