29 lines
575 B
PHP
29 lines
575 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");
|
|
|
|
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;
|
|
?>
|