<?php
require_once "auth.php";
$user = API_AUTH();

$q = $conn->prepare("
    SELECT id,type,msg,symbol,ts
    FROM logs
    WHERE user_id=?
    ORDER BY id DESC
    LIMIT 500
");
$q->bind_param("i",$user['id']);
$q->execute();
$res = $q->get_result();

$data=[];
while($r=$res->fetch_assoc()) $data[]=$r;

echo json_encode($data);
?>
