📄 Source: switch_chat.php
<?php
session_name('INBOXZERO');
session_start();
require_once 'database.php';
header('Content-Type: application/json');
$input = json_decode(file_get_contents('php://input'), true);
$chatId = $input['chat_id'] ?? 0;
if ($chatId) {
$_SESSION['current_conversation_id'] = $chatId;
$db = new ChatDatabase();
$messages = $db->getMessages($chatId);
echo json_encode(['success' => true, 'messages' => $messages]);
} else {
echo json_encode(['error' => 'Invalid chat ID']);
}
?>
← Back