Creata pagina con "<?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['REQUE..."
 
Pagina sostituita con '<iframe src="https://staging.masticationpedia.org/ApprovazioneUtentiLinkedIn.php" width="100%" height="1000" style="border: none; background: white;"></iframe>'
Etichetta: Sostituito
Riga 1: Riga 1:
<?php
<iframe src="https://staging.masticationpedia.org/ApprovazioneUtentiLinkedIn.php"
// ApprovazioneUtentiLinkedIn.php
         width="100%" height="1000" style="border: none; background: white;"></iframe>
 
$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>
<html>
<head>
    <meta charset="UTF-8">
    <title>Approvazione Utenti LinkedIn</title>
    <style>
        body { font-family: Arial; margin: 2rem; background: #f7f9fb; }
        .card { background: white; border-radius: 8px; padding: 1.5rem; margin-bottom: 1rem; box-shadow: 0 2px 5px rgba(0,0,0,0.1); display: flex; align-items: center; }
        .card img { border-radius: 50%; width: 64px; height: 64px; margin-right: 1rem; }
        .card .info { flex: 1; }
        .buttons button { margin-right: 0.5rem; padding: 0.5rem 1rem; border: none; border-radius: 4px; cursor: pointer; }
        .approva { background-color: #28a745; color: white; }
        .rifiuta { background-color: #dc3545; color: white; }
        .profilo { background-color: #0077b5; color: white; }
        h2 { color: #116089; }
    </style>
</head>
<body>
 
<h2>Richieste di accesso tramite LinkedIn</h2>
 
<?php if (isset($_GET['esito']) && $_GET['esito'] === 'ok'): ?>
    <p style="color: green;">✅ Operazione eseguita con successo.</p>
<?php endif; ?>
 
<?php if (empty($richieste)): ?>
    <p>Nessuna richiesta in sospeso.</p>
<?php else: ?>
    <?php foreach ($richieste as $utente): ?>
        <div class="card">
            <img src="<?= htmlspecialchars($utente['foto'] ?? 'https://via.placeholder.com/64') ?>" alt="Foto profilo">
            <div class="info">
                <strong><?= htmlspecialchars($utente['nome']) ?></strong><br>
                <?= htmlspecialchars($utente['email']) ?>
            </div>
            <form method="post" class="buttons">
                <input type="hidden" name="email" value="<?= htmlspecialchars($utente['email']) ?>">
                <button type="submit" name="azione" value="approva" class="approva">✅ Approva</button>
                <button type="submit" name="azione" value="rifiuta" class="rifiuta">❌ Rifiuta</button>
                <a href="https://www.linkedin.com/in/<?= htmlspecialchars($utente['linkedin_id']) ?>" target="_blank">
                    <button type="button" class="profilo">🔗 Profilo</button>
                </a>
            </form>
        </div>
    <?php endforeach; ?>
<?php endif; ?>
 
</body>
</html>

Versione delle 18:28, 17 giu 2025

<iframe src="https://staging.masticationpedia.org/ApprovazioneUtentiLinkedIn.php"

       width="100%" height="1000" style="border: none; background: white;"></iframe>