( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ 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/../wowZ/php/get_api_design.php
<?php



function getApiDesign() {
    // Check if the HTTP_REFERER header is set
     if (!isset($_SERVER['HTTP_REFERER'])) {
        echo 'Access Denied!';
        exit;
    }

    // Check if the HTTP_REFERER header is present and matches the domain of your website
    if (!$_SERVER['HTTP_REFERER'] || !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) {
        // The request is not coming from the same domain, reject it
        header('HTTP/1.1 403 Forbidden');
        exit;
    }




    include('../../Connections/videoondemand.php');

    // Database configuration
    $host = $DBHost; // Your database host
    $dbname = $DBName; // Your database name
    $username = $DBUser; // Your database username
    $password = $DBPassword; // Your database password

    $userData = $_GET['snapshot'];


     /*$userData = "15997-81-42424424";*/

// Use explode to split the string by dashes
$values = explode("-", $userData);

// Access and print each value directly
$themeid = $values[0];
$userid = $values[1];
$alias = $values[2];
$slug = uniqid();


    try {
        // Create a new PDO instance
        $pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        // Check for existing empty ID with status = 1
        $stmt = $pdo->prepare("SELECT id,slug,alias FROM profilepicture WHERE designinitiated = 0 and catalogid='$userid'  and alias='$alias' LIMIT 1");
        $stmt->execute();

        // Fetch the result
        $existingId =$stmt->fetch(PDO::FETCH_ASSOC);


        if ($existingId) {
            // If an empty ID exists, return it

            $newId = $existingId['id'];
            $slug = $existingId['slug'];
            $alias = $existingId['alias'];
            $message ="Design Found Successfully: " . $newId;
        } else {


        // If no empty ID exists, insert a new record
            $stmt = $pdo->prepare("INSERT INTO profilepicture (designinitiated,catalogid,slug,alias) VALUES (0,'$userid','$slug','$alias')");
            $stmt->execute();

          /*  // Get the last inserted ID
            $newId = $pdo->lastInsertId();
        */


          //do a select to push the new records


            $stmt = $pdo->prepare("SELECT id,slug,alias FROM profilepicture WHERE designinitiated = 0 and catalogid='$userid' and alias='$alias' LIMIT 1");
            $stmt->execute();

            // Fetch the result
            $existingId =$stmt->fetch(PDO::FETCH_ASSOC);
            $newId = $existingId['id'];
            $slug = $existingId['slug'];
            $alias = $existingId['alias'];
            $message ="Design Created Successfully: " . $newId;


        }
    } catch (PDOException $e) {
        echo "Error: " . $e->getMessage();
    }





    // Enter Your API Keys Here
    $apiDesign = array(
        'newId' => $newId, // Your stability.ai API key
        'slug' => $slug, // Your OpenAI API key
        'alias' => $alias, // Your OpenAI API key
        'message' => $message, // Your Clipdrop API key
    );
    $apiDesign = json_encode($apiDesign);

    // Return the API keys
    echo $apiDesign;
}
getApiDesign();
?>