( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ 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/../n8nphp/auth.php
<?php
session_start();
// Load config and DB helper
$appCfg = @include __DIR__ . '/config/app.php';
require_once __DIR__ . '/lib/Db.php';
$authCfg = is_array($appCfg) && isset($appCfg['auth']) ? $appCfg['auth'] : [
    'username' => 'admin',
    'password' => 'admin',
    'password_hash' => '',
];

// Already authenticated
if (!empty($_SESSION['auth'])) {
    header('Location: index.php');
    exit;
}

$error = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $u = trim($_POST['username'] ?? '');
    $p = trim($_POST['password'] ?? '');
    $row = find_user_by_email($u);
    if ($row) {
        $storedEmail = (string)($row['user_email'] ?? '');
        $storedHash = (string)($row['pwd'] ?? '');
        $catalogName = (string)($row['catalogname'] ?? '');
        $emailOk = (strcasecmp($storedEmail, $u) === 0);
        $passOk = ($storedHash !== '' && hash_equals($storedHash, md5($p)));
        if ($emailOk && $passOk) {
            $_SESSION['auth'] = true;
            $_SESSION['user_email'] = $storedEmail;
            $_SESSION['name'] = $catalogName ?: $storedEmail;
            header('Location: index.php');
            exit;
        }
    }
    $error = 'Invalid credentials';
}
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Strategy & Content Studio — Sign In</title>
    <link rel="stylesheet" href="assets/styles.css">
</head>
<body>
<header>
    <h1>Strategy & Content Studio</h1>
    </header>
<div class="layout">
    <aside>
        <h2 style="color:#f9fafb; font-size:18px; margin-top:0;">Sign In</h2>
        <div style="margin-top:12px; font-size:12px; color:#9ca3af;">Access is restricted. Please authenticate to continue.</div>
    </aside>
    <div class="container">
        <div class="card" style="max-width: 480px; margin-top: 24px;">
            <h2>Welcome</h2>
            <p style="color: var(--text-muted); margin-top: 0;">Enter your credentials to access the dashboard.</p>
            <?php if ($error): ?>
                <div class="notice error" style="margin-bottom:12px; padding:10px; background:#fee2e2; color:#991b1b; border:1px solid #fecaca; border-radius:10px;"><?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?></div>
            <?php endif; ?>
            <form method="post">
                <div class="row"><input type="text" name="username" placeholder="Email" required></div>
                <div class="row"><input type="password" name="password" placeholder="Password" required></div>
                <div class="row"><button type="submit">Sign In</button></div>
                <div class="config">Tip: credentials are validated against the `users` table (email/md5).</div>
            </form>
            <div class="cta-group" style="margin-top:12px;">
                <a class="button secondary" href="register.php">Create account</a>
                <a class="button secondary" href="forgot.php">Forgot password</a>
            </div>
        </div>
        <div class="card" style="margin-top: 16px;">
            <div class="hero hero-aws">
                <div class="title">About the Studio</div>
                <div class="subtitle">Plan, create, and launch persuasive strategies and content with guided workflows.</div>
                <div class="cta-group">
                    <a class="button primary" href="register.php">Create account</a>
                    <a class="button secondary" href="forgot.php">Forgot password</a>
                </div>
                <ul class="bullets">
                    <li>Generate proposals, pitch outlines, contracts, and strategic narratives.</li>
                    <li>Control tone, brand voice, CTA, and audience for consistent results.</li>
                    <li>Operate with visibility: health checks, workflow status, and webhook triggers.</li>
                </ul>
            </div>
            <div class="grid">
                <div class="card">
                    <h3>How it works</h3>
                    <ol style="margin:0 0 8px 18px;">
                        <li>Pick a workflow after signing in.</li>
                        <li>Describe your objective, audience, tone, and constraints.</li>
                        <li>Trigger the webhook and review results.</li>
                        <li>Iterate with templates and Q&A when needed.</li>
                    </ol>
                    <div class="config">Secure, session-based access. Auth via internal users database.</div>
                </div>
                <div class="card">
                    <h3>Highlights</h3>
                    <ul class="bullets">
                        <li>Fast: kick off workflows in seconds.</li>
                        <li>Consistent: on-brand outputs via templates.</li>
                        <li>Observable: health, status, and logs where you need them.</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>