Edit dashboard.php via Editor
This commit is contained in:
parent
96076ad6fc
commit
ab93e047c8
23
dashboard.php
Normal file
23
dashboard.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?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;
|
||||||
Loading…
x
Reference in New Issue
Block a user