37223-vm/dashboard.php
2026-01-01 09:50:21 +00:00

25 lines
482 B
PHP

<?php
session_start();
header("Content-Type: application/json");
require "db/config.php";
$userId = $_SESSION['user_id'] ?? null;
if (!$userId) {
http_response_code(401);
echo json_encode(["error" => "unauthorized"]);
exit;
}
$stmt = $pdo->prepare("
SELECT id, title, status, created_at, updated_at, final_video_url
FROM projects
WHERE user_id = ?
ORDER BY created_at DESC
");
$stmt->execute([$userId]);
echo json_encode($stmt->fetchAll());
exit;
?>