prepare("UPDATE account SET pin = ? WHERE id_account = ?"); if ($stmt->execute([$pin, $id_account])) { header("Location: finger.php?id_account=$id_account"); exit; } else { $error = "Failed to save PIN."; } } else { $temp = $_SESSION['temp_register']; $stmt = $pdo->prepare("INSERT INTO account (name, username, password, password_enc, code_register, status, foto, pin) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); if ($stmt->execute([ $temp['name'], $temp['username'], $temp['password'], $temp['password_enc'], $temp['code_register'], $temp['status'], $temp['foto'], $pin ])) { $new_id = $pdo->lastInsertId(); include_once 'notification_helper.php'; send_notification($pdo, 'mdi-account-arrow-right', 'New Account Registration', "User {$temp['name']} ({$temp['username']}) registered independently.", "Current status: rejected. PIN verification not completed. Please check in the Account menu.", false); require_once 'PushHelper.php'; PushHelper::broadcastToAdmins($pdo, 'New Account Registration', "Account {$temp['name']} ({$temp['username']}) has registered independently.", '/operations_account.php'); unset($_SESSION['temp_register']); header("Location: finger.php?id_account=$new_id"); exit; } else { $error = "Failed to save registration data and PIN."; } } } catch (PDOException $e) { $error = "Database Error: " . $e->getMessage(); } } } ?>
Create a 6-digit PIN for your account security.