403Webshell
Server IP : 173.209.174.21  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : nodor ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/wcfs/fuelmapping/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wcfs/fuelmapping/fuel_mapper.php.cardID
<?php
function load_account_map($path) {
    $map = [];
    if (file_exists($path) && ($handle = fopen($path, 'r')) !== false) {
        while (($data = fgetcsv($handle)) !== false) {
            if (count($data) >= 2) {
                $map[trim($data[0])] = trim($data[1]);
            }
        }
        fclose($handle);
    }
    return $map;
}

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['fuel_file'])) {
    $fuelFile = $_FILES['fuel_file']['tmp_name'];
    $output = fopen('php://output', 'w');

    // Product ID map
    $productMap = [
        '01' => 'Unleaded',
        '02' => 'Unleaded Plus',
        '06' => 'Road Diesel',
        '07' => 'Farm Diesel'
    ];

    // Load account mapping from fixed file on the server
    $acctMapPath = __DIR__ . '/account_map.csv';
    $acctMap = load_account_map($acctMapPath);

    // Set headers for download
    header('Content-Type: text/csv');
    header('Content-Disposition: attachment; filename="mapped_fuel_data.csv"');

    if (($handle = fopen($fuelFile, 'r')) !== false) {
        $headers = fgetcsv($handle);
        fputcsv($output, $headers);

        $prodIdIndex = array_search('ProdId', $headers);
        $acctNameIndex = array_search('AcctName', $headers);

        while (($data = fgetcsv($handle)) !== false) {
            // Replace ProdId
            if (isset($data[$prodIdIndex]) && isset($productMap[$data[$prodIdIndex]])) {
                $data[$prodIdIndex] = $productMap[$data[$prodIdIndex]];
            }

            // Replace AcctName
            if (isset($data[$acctNameIndex]) && isset($acctMap[$data[$acctNameIndex]])) {
                $data[$acctNameIndex] = $acctMap[$data[$acctNameIndex]];
            }

            fputcsv($output, $data);
        }
        fclose($handle);
    }
    exit;
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Fuel CSV Mapper</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 50px auto; max-width: 600px; text-align: center; }
        input[type="file"], button { margin: 10px 0; padding: 8px; }
    </style>
</head>
<body>
    <h2>Fuel CSV Mapper Tool</h2>
    <form action="fuel_mapper.php" method="POST" enctype="multipart/form-data">
        <label>Select Fuel CSV:</label><br>
        <input type="file" name="fuel_file" accept=".csv" required><br><br>
        <button type="submit">Upload and Convert</button>
    </form>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit