'error', 'message' => 'No Line UID provided']); exit; } // Check if this Line UID is already in the system and active $stmt = $pdo_bot->prepare("SELECT * FROM line_staff_register WHERE user_id = ? AND ksh_user = 'Y'"); $stmt->execute([$line_uid]); $staff = $stmt->fetch(); if ($staff) { // User exists, set session $_SESSION['cid'] = $staff['cid']; echo json_encode(['status' => 'success', 'redirect' => 'index.php']); } else { // User not found, needs registration echo json_encode(['status' => 'not_found']); } ?>