HEX
Server: Apache
System: Linux webm004.cluster129.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User: windevelwb (110072)
PHP: 8.5.0
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/windevelwb/www/payconiq/Macphp.php
<?php
// fix_listes.php
$inputFile  = __DIR__ . '/listes.txt'; // ton fichier renommé
$outputFile = __DIR__ . '/liste.php';  // fichier généré

if (!file_exists($inputFile)) {
    echo "Fichier d'entrée introuvable : $inputFile\n";
    exit(1);
}

$lines = file($inputFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if ($lines === false) {
    echo "Impossible de lire $inputFile\n";
    exit(1);
}

$fh = fopen($outputFile, 'w');
if (!$fh) {
    echo "Impossible d'ouvrir $outputFile en écriture\n";
    exit(1);
}

// En-tête PHP
fwrite($fh, "<?php\n");
fwrite($fh, "/**\n * liste.php généré automatiquement\n */\n\n");
fwrite($fh, '$AdresseMac = array(' . PHP_EOL);

// Écrire chaque adresse entre apostrophes, nettoyer les caractères indésirables
$total = count($lines);
for ($i = 0; $i < $total; $i++) {
    $raw = trim($lines[$i]);
    // supprimer quotes ou virgules déjà présentes en début/fin
    $clean = trim($raw, " \t\n\r'\",;");
    if ($clean === '') continue;
    $clean = strtoupper($clean);
    $comma = ($i === $total - 1) ? '' : ',';
    fwrite($fh, "    '" . $clean . "'" . $comma . PHP_EOL);
}

fwrite($fh, ");" . PHP_EOL);
fclose($fh);

echo "Fichier généré : $outputFile (" . ($total) . " lignes traitées)\n";