prepare("SELECT * FROM neptune_users WHERE user_token = ?"); $stmt->execute([$user_token]); $user = $stmt->fetch(); if ($user) { $_SESSION['neptune_loggedin'] = true; $_SESSION['neptune_user_token'] = $user['user_token']; $_SESSION['neptune_username'] = $user['username']; $_SESSION['neptune_role'] = $user['role']; header('Location: /'); exit; } else { // First user becomes admin $count = $db->query("SELECT COUNT(*) as c FROM neptune_users")->fetch()['c']; $role = ($count == 0) ? 'admin' : 'user'; $stmt = $db->prepare("INSERT INTO neptune_users (user_token, username, email, role) VALUES (?, ?, ?, ?)"); $stmt->execute([$user_token, $username, $email, $role]); $_SESSION['neptune_loggedin'] = true; $_SESSION['neptune_user_token'] = $user_token; $_SESSION['neptune_username'] = $username; $_SESSION['neptune_role'] = $role; header('Location: /'); exit; } } else { $error = 'Authentication failed: ' . ($data['msg'] ?? 'unknown error'); } } } ?> Neptune - Login

Neptune

Cybersecurity Incident Journal

Log in with Jakach Auth First user automatically becomes admin