( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
require_once __DIR__ . '/../../config.php';
header('Content-Type: application/json; charset=utf-8');
$designId = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
if ($designId <= 0) {
echo json_encode(['ok' => false, 'error' => 'Invalid design ID']);
exit;
}
$dbPath = __DIR__ . '/../../brandSync/config/database.php';
if (!file_exists($dbPath)) {
echo json_encode(['ok' => false, 'error' => 'Database configuration not found']);
exit;
}
require $dbPath;
if (!isset($pdo)) {
echo json_encode(['ok' => false, 'error' => 'Database connection not available']);
exit;
}
$sql = "SELECT pp.id, pp.title, pp.poster, pp.picture, pp.alias, pp.price, pp.category, pp.catalogid, pp.h, pp.w, pp.keywords,
hcl.name AS category_name, hc.slug AS category_slug
FROM profilepicture pp
LEFT JOIN h_categories_lang hcl ON hcl.category_id = pp.category
LEFT JOIN h_categories hc ON hc.id = hcl.category_id
WHERE pp.id = ?
AND pp.isdisplay = '13'
AND pp.type = '2'
AND pp.public = '1'
AND pp.catalogid = 152
LIMIT 1";
$stmt = $pdo->prepare($sql);
$stmt->execute([$designId]);
$design = $stmt->fetch(PDO::FETCH_ASSOC);
if ($design) {
$response = [
'ok' => true,
'data' => [
'id' => $design['id'],
'title' => $design['title'],
'poster' => $design['poster'],
'picture' => $design['picture'],
'alias' => $design['alias'],
'price' => $design['price'],
'category' => $design['category'],
'category_name' => $design['category_name'],
'category_slug' => $design['category_slug'],
'catalogid' => $design['catalogid'],
'h' => $design['h'],
'w' => $design['w'],
'keywords' => $design['keywords']
]
];
} else {
$response = ['ok' => false, 'error' => 'Design not found'];
}
echo json_encode($response);
exit;