( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/../tmpr/..//tmpr/../tmpr/../tmpr/../tmpr/../looksy/functions.php
<?php
require_once 'config.php';

header('Content-Type: application/json');

$action = $_POST['action'] ?? '';

if ($action === 'list_projects') {
    // List all projects
    try {
        $stmt = $pdo->query('SELECT id, name, created_at FROM projects ORDER BY created_at DESC');
        $projects = $stmt->fetchAll();
        echo json_encode(['status' => 'success', 'projects' => $projects]);
    } catch (PDOException $e) {
        echo json_encode(['status' => 'error', 'message' => 'Failed to fetch projects']);
    }
} elseif ($action === 'create_project') {
    // Create a new project
    $name = trim($_POST['name'] ?? '');
    if (strlen($name) < 3) {
        echo json_encode(['status' => 'error', 'message' => 'Project name too short']);
        exit;
    }
    try {
        $stmt = $pdo->prepare('INSERT INTO projects (name, created_at) VALUES (:name, NOW())');
        $stmt->execute(['name' => $name]);
        echo json_encode(['status' => 'success']);
    } catch (PDOException $e) {
        echo json_encode(['status' => 'error', 'message' => 'Failed to create project']);
    }
} else {
    echo json_encode(['status' => 'error', 'message' => 'Invalid action']);
}