Add initial implementation of Fantacalcio application

This commit is contained in:
Simone
2026-03-07 17:15:34 +01:00
parent 6e74a538ea
commit dc6fc7b7e0
41 changed files with 2086 additions and 0 deletions
Executable
+39
View File
@@ -0,0 +1,39 @@
<?php
require 'conversioni.php';
if (!isset($_GET['type'])) {
die('Tipo di esportazione non specificato.');
}
$type = $_GET['type'];
$sourceFile = '';
$outputFilename = '';
$exportFunction = '';
if ($type === 'giocatori') {
$sourceFile = 'giocatori.json';
$outputFilename = 'giocatori.csv';
$exportFunction = 'esportaGiocatori';
} elseif ($type === 'voti') {
$sourceFile = 'voti.json';
$outputFilename = 'voti.csv';
$exportFunction = 'esportaVoti';
} else {
die('Tipo di esportazione non valido.');
}
if (!file_exists($sourceFile)) {
die("File di origine non trovato: $sourceFile");
}
$jsonContent = file_get_contents($sourceFile);
$csvContent = $exportFunction($jsonContent);
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename="' . $outputFilename . '"');
// Pulisce il buffer di output prima di inviare il file
ob_end_clean();
echo $csvContent;
exit;