403Webshell
Server IP : 173.209.174.21  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : nodor ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/thelittlebigshow/self-hosted/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/thelittlebigshow/self-hosted/self_hosted_install.php
<?php
require_once __DIR__ . '/brand_header.php';
require_once __DIR__ . '/self_hosted_activation_helpers.php';

if (!selfHostedInstallerAllowed()) {
    http_response_code(404);
    echo 'Installer not available on this host.';
    exit;
}

$error = '';
$success = '';

$values = [
    'store_name' => SELF_HOSTED_STORE_NAME !== '' ? SELF_HOSTED_STORE_NAME : 'HouseTab Pro',
    'db_host' => SELF_HOSTED_DB_HOST !== '' ? SELF_HOSTED_DB_HOST : 'localhost',
    'db_name' => SELF_HOSTED_DB_NAME,
    'db_user' => SELF_HOSTED_DB_USER,
    'db_password' => SELF_HOSTED_DB_PASSWORD,
    'license_key' => '',
    'admin_email' => '',
    'admin_password' => '',
    'confirm_password' => '',
];

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $values['store_name'] = trim((string) ($_POST['store_name'] ?? ''));
    $values['db_host'] = trim((string) ($_POST['db_host'] ?? 'localhost'));
    $values['db_name'] = trim((string) ($_POST['db_name'] ?? ''));
    $values['db_user'] = trim((string) ($_POST['db_user'] ?? ''));
    $values['db_password'] = (string) ($_POST['db_password'] ?? '');
    $values['license_key'] = strtoupper(trim((string) ($_POST['license_key'] ?? '')));
    $values['admin_email'] = trim((string) ($_POST['admin_email'] ?? ''));
    $values['admin_password'] = (string) ($_POST['admin_password'] ?? '');
    $values['confirm_password'] = (string) ($_POST['confirm_password'] ?? '');

    try {
        if ($values['db_name'] === '' || $values['db_user'] === '') {
            throw new RuntimeException('Database name and database user are required.');
        }

        if ($values['license_key'] === '') {
            throw new RuntimeException('A self-hosted license key is required.');
        }

        if ($values['admin_email'] === '') {
            throw new RuntimeException('An admin email is required for the self-hosted app login.');
        }

        if ($values['admin_password'] === '') {
            throw new RuntimeException('An admin password is required for the self-hosted app login.');
        }

        if ($values['admin_password'] !== $values['confirm_password']) {
            throw new RuntimeException('The admin password and confirmation do not match.');
        }

        $conn = selfHostedProvisionDatabase(
            $values['db_host'],
            $values['db_name'],
            $values['db_user'],
            $values['db_password']
        );
        selfHostedInstallSchema($conn);
        selfHostedSetAppCredentials($conn, $values['admin_email'], $values['admin_password']);
        $conn->close();

        selfHostedWriteLocalConfig([
            'db_host' => $values['db_host'],
            'db_name' => $values['db_name'],
            'db_user' => $values['db_user'],
            'db_password' => $values['db_password'],
            'store_name' => $values['store_name'] !== '' ? $values['store_name'] : 'HouseTab Pro',
        ]);

        $activation = selfHostedActivateLicense($values['license_key'], $values['db_name'], selfHostedCurrentDomain());
        if (empty($activation['ok'])) {
            throw new RuntimeException((string) ($activation['error'] ?? 'Could not activate the license.'));
        }

        header('Location: /app/index.php?license_activated=1');
        exit;
    } catch (Throwable $e) {
        $error = $e->getMessage();
    }
}

$currentState = selfHostedLoadState();
if ($error === '' && selfHostedHasLocalConfig() && !empty($currentState['license_key'])) {
    $success = 'This self-hosted install is already configured. You can update the settings below if needed.';
    $values['license_key'] = (string) ($currentState['license_key'] ?? '');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>HouseTab Pro Installer</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 28px;
            background: #f8fafc;
            color: #1f2937;
        }

        .container {
            max-width: 860px;
            margin: 0 auto;
            background: #fff;
            padding: 28px;
            border-radius: 16px;
            box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
        }

        h1 {
            margin-top: 0;
        }

        .intro {
            margin-bottom: 22px;
            color: #475569;
            line-height: 1.6;
        }

        .grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 18px;
        }

        .field-full {
            grid-column: 1 / -1;
        }

        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 700;
        }

        input[type="text"],
        input[type="password"] {
            width: 100%;
            padding: 12px 14px;
            border: 1px solid #cbd5e1;
            border-radius: 10px;
            box-sizing: border-box;
            font-size: 15px;
        }

        .card {
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 14px;
            padding: 18px;
            margin-bottom: 18px;
        }

        .card h2 {
            margin: 0 0 14px;
            font-size: 20px;
        }

        .note,
        .error,
        .success {
            padding: 12px 14px;
            border-radius: 10px;
            margin-bottom: 16px;
        }

        .note {
            background: #eff6ff;
            border: 1px solid #bfdbfe;
            color: #1d4ed8;
        }

        .error {
            background: #fef2f2;
            border: 1px solid #fecaca;
            color: #b91c1c;
        }

        .success {
            background: #ecfdf5;
            border: 1px solid #86efac;
            color: #166534;
        }

        .submit-btn {
            display: inline-block;
            margin-top: 18px;
            padding: 12px 20px;
            background: #2563eb;
            color: #fff;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-size: 15px;
            font-weight: 700;
        }

        .meta {
            margin-top: 18px;
            font-size: 14px;
            color: #475569;
        }

        @media (max-width: 700px) {
            body {
                padding: 16px;
            }

            .container {
                padding: 20px;
            }

            .grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
    <?php echo appBrandStyles(); ?>
</head>
<body>
<div class="container">
    <?php renderAppBrandHeader(); ?>
    <h1>HouseTab Pro Self-Hosted Installer</h1>
    <p class="intro">This wizard connects your database, installs the core HouseTab Pro tables, creates the local app admin login, saves a local config file for this server, and activates your self-hosted license in one pass.</p>

    <?php if ($error !== ''): ?>
        <div class="error"><?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?></div>
    <?php elseif ($success !== ''): ?>
        <div class="success"><?php echo htmlspecialchars($success, ENT_QUOTES, 'UTF-8'); ?></div>
    <?php else: ?>
        <div class="note">This installer is meant for customer-owned self-hosted installs. It is blocked on your hosted SaaS domain.</div>
    <?php endif; ?>

    <form method="post">
        <div class="card">
            <h2>Store Details</h2>
            <div class="grid">
                <div class="field-full">
                    <label for="store_name">Store Name</label>
                    <input type="text" id="store_name" name="store_name" value="<?php echo htmlspecialchars($values['store_name'], ENT_QUOTES, 'UTF-8'); ?>" placeholder="Your store name">
                </div>
            </div>
        </div>

        <div class="card">
            <h2>Database Setup</h2>
            <div class="grid">
                <div>
                    <label for="db_host">Database Host</label>
                    <input type="text" id="db_host" name="db_host" value="<?php echo htmlspecialchars($values['db_host'], ENT_QUOTES, 'UTF-8'); ?>" placeholder="localhost" required>
                </div>
                <div>
                    <label for="db_name">Database Name</label>
                    <input type="text" id="db_name" name="db_name" value="<?php echo htmlspecialchars($values['db_name'], ENT_QUOTES, 'UTF-8'); ?>" placeholder="housetab_store" required>
                </div>
                <div>
                    <label for="db_user">Database User</label>
                    <input type="text" id="db_user" name="db_user" value="<?php echo htmlspecialchars($values['db_user'], ENT_QUOTES, 'UTF-8'); ?>" required>
                </div>
                <div>
                    <label for="db_password">Database Password</label>
                    <input type="password" id="db_password" name="db_password" value="<?php echo htmlspecialchars($values['db_password'], ENT_QUOTES, 'UTF-8'); ?>">
                </div>
            </div>
        </div>

        <div class="card">
            <h2>License Activation</h2>
            <div class="grid">
                <div class="field-full">
                    <label for="license_key">License Key</label>
                    <input type="text" id="license_key" name="license_key" value="<?php echo htmlspecialchars($values['license_key'], ENT_QUOTES, 'UTF-8'); ?>" placeholder="HTP-XXXX-XXXX-XXXX-XXXX" autocomplete="off" spellcheck="false" required>
                </div>
            </div>
            <div class="meta">
                This will bind the license to <strong><?php echo htmlspecialchars(selfHostedCurrentDomain(), ENT_QUOTES, 'UTF-8'); ?></strong> using a server fingerprint generated during setup.
            </div>
        </div>

        <div class="card">
            <h2>App Admin Login</h2>
            <div class="grid">
                <div class="field-full">
                    <label for="admin_email">Admin Email</label>
                    <input type="email" id="admin_email" name="admin_email" value="<?php echo htmlspecialchars($values['admin_email'], ENT_QUOTES, 'UTF-8'); ?>" placeholder="owner@example.com" required>
                </div>
                <div>
                    <label for="admin_password">Admin Password</label>
                    <input type="password" id="admin_password" name="admin_password" value="<?php echo htmlspecialchars($values['admin_password'], ENT_QUOTES, 'UTF-8'); ?>" minlength="8" required>
                </div>
                <div>
                    <label for="confirm_password">Confirm Password</label>
                    <input type="password" id="confirm_password" name="confirm_password" value="<?php echo htmlspecialchars($values['confirm_password'], ENT_QUOTES, 'UTF-8'); ?>" minlength="8" required>
                </div>
            </div>
            <div class="meta">
                This creates the login used to open the installed self-hosted app after setup.
            </div>
        </div>

        <button type="submit" class="submit-btn">Install HouseTab Pro</button>
    </form>
</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit