37223-vm/dashboard.php
2026-01-01 09:58:22 +00:00

32 lines
635 B
PHP

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
header("Content-Type: application/json");
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 = db()->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;
?>