<?php // ApprovazioneUtentiLinkedIn.php
$richieste_file = __DIR__ . '/linkedin_requests.json'; $approvati_file = __DIR__ . '/approved_users.json';
function leggi_json($file) {
return file_exists($file) ? json_decode(file_get_contents($file), true) : [];
}
function salva_json($file, $dati) {
file_put_contents($file, json_encode($dati, JSON_PRETTY_PRINT));
}
$richieste = leggi_json($richieste_file); $approvati = leggi_json($approvati_file);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = $_POST['email']; $azione = $_POST['azione'];
foreach ($richieste as $i => $utente) { if ($utente['email'] === $email) { if ($azione === 'approva') { $utente['data_approvazione'] = date('Y-m-d'); $approvati[] = $utente; salva_json($approvati_file, $approvati); } unset($richieste[$i]); salva_json($richieste_file, array_values($richieste)); header('Location: ApprovazioneUtentiLinkedIn.php?esito=ok'); exit; } }
}
?><!DOCTYPE html>
Richieste di accesso tramite LinkedIn
✅ Operazione eseguita con successo.
Nessuna richiesta in sospeso.