fix: 🐛 filter laporan, dan cetak laporan menggunakan session

filter laporan, dan cetak laporan menggunakan session, file yang di modifikasi : sertifikat.php, laporan.php, halaman_utama.php, logout.php
This commit is contained in:
Kadek Arie Wira Kusuma 2025-03-11 16:43:54 +08:00
parent 8c8c53b417
commit 4a3c0392d0
4 changed files with 10 additions and 5 deletions

View File

@ -1,13 +1,14 @@
<?php
include "../fpdf/fpdf.php";
include "../../koneksi.php";
session_start();
// Buat objek PDF
$pdf = new FPDF('P', 'mm', 'A4');
$pdf->AddPage();
// ===== HEADER (KOP SURAT) ===== //
$pdf->Image('../../gambar/logoti.png', 10, 6, 20); // Logo
// $pdf->Image('../../gambar/logoti.png', 10, 6, 20); // Logo
$pdf->SetFont('Arial', 'B', 14);
$pdf->Cell(190, 7, 'SMK TI Bali Global Denpasar', 0, 1, 'C');
$pdf->SetFont('Arial', '', 12);
@ -88,8 +89,8 @@ function tampilRekapKegiatan($pdf, $koneksi, $angkatan = NULL, $status = NULL) {
}
// ===== Panggil Fungsi Berdasarkan Filter User ===== //
$angkatan = isset($_COOKIE['angkatan']) ? $_COOKIE['angkatan'] : 'semua';
$status = isset($_COOKIE['status']) ? $_COOKIE['status'] : 'semua';
$angkatan = isset($_SESSION['angkatan']) ? $_SESSION['angkatan'] : 'semua';
$status = isset($_SESSION['status']) ? $_SESSION['status'] : 'semua';
if ($angkatan == 'semua' && $status == 'semua') {
$result_angkatan = mysqli_query($koneksi, "SELECT DISTINCT Angkatan FROM siswa ORDER BY Angkatan ASC");

View File

@ -5,5 +5,6 @@ setcookie('nama_lengkap', '', time(), '/');
setcookie('nis', '', time(), '/');
setcookie('angkatan', '', time(), '/');
setcookie('status', '', time(), '/');
session_destroy();
echo "<script>alert('Berhasil Logout');window.location.href='login.php'</script>";
?>

View File

@ -1,5 +1,6 @@
<?php
include "../koneksi.php";
session_start();
?>
<!DOCTYPE html>
<html lang="id">

View File

@ -56,8 +56,10 @@ function getSertifikat($koneksi, $status = '', $kegiatan = '') {
if(@$_POST['tombol_cetak_laporan']){
setcookie('angkatan', $_POST['angkatan'], time() + (60 * 60 * 24 * 7), '/');
setcookie('status', $_POST['status'], time() + (60 * 60 * 24 * 7), '/');
$_SESSION['angkatan'] = $_POST['angkatan'];
$_SESSION['status'] = $_POST['status'];
// setcookie('angkatan', $_POST['angkatan'], time() + (60 * 60 * 24 * 7), '/');
// setcookie('status', $_POST['status'], time() + (60 * 60 * 24 * 7), '/');
echo "<script>window.location.href='../cetak/laporan/laporan.php';</script>";
}