<?php
require('include/functions.php');
echo "Server Time: " . date('Y-m-d H:i:s') . "\n";
echo "GMT Time: " . gmdate('Y-m-d H:i:s') . "\n";
echo "Bot ID: " . sb_get_bot_ID() . "\n";
echo "Is User 1 Agent? " . (sb_is_agent(1) ? 'Yes' : 'No') . "\n";

$cid = 25275;
// Get last 3 messages to see the flow
$msgs = sb_db_get('SELECT * FROM sb_messages WHERE conversation_id = ' . $cid . ' ORDER BY id DESC LIMIT 3', false);
if ($msgs) {
    foreach ($msgs as $m) {
        echo "Msg ID: " . $m['id'] . " | User: " . $m['user_id'] . " | Time: " . $m['creation_time'] . " | Msg: " . mb_substr($m['message'], 0, 50) . "...\n";
    }
}
?>
