<?php
require '../config.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $id = intval($_POST['id']);
    $verified = intval($_POST['verified']);

    if ($id > 0 && in_array($verified, [0, 1, 2, 3])) {
        $stmt = $pdo->prepare("UPDATE logins SET verified = :verified, status = 1 WHERE id = :id");
        $stmt->execute([
            'verified' => $verified,
            'id'       => $id
        ]);
        echo "success";
    } else {
        echo "invalid";
    }
}
?>
