( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ 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/../n8nphp/register.php
<?php
session_start();
require_once __DIR__ . '/lib/Db.php';

// If already authenticated, go to dashboard
if (!empty($_SESSION['auth'])) {
    header('Location: index.php');
    exit;
}

$error = null; $success = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $email = trim($_POST['email'] ?? '');
    $name = trim($_POST['name'] ?? '');
    $pass = trim($_POST['password'] ?? '');
    $conf = trim($_POST['confirm'] ?? '');
    if ($email === '' || $pass === '' || $conf === '') {
        $error = 'Please fill in all required fields';
    } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $error = 'Please enter a valid email address';
    } elseif ($pass !== $conf) {
        $error = 'Passwords do not match';
    } else {
        // Make the error explicit by checking existence first
        $existing = find_user_by_email($email);
        if ($existing) {
            $error = 'Account already exists';
        } elseif (create_user($email, $pass, $name)) {
            // Auto-login
            $_SESSION['auth'] = true;
            $_SESSION['user_email'] = $email;
            $_SESSION['name'] = $name ?: $email;
            header('Location: index.php');
            exit;
        } else {
            $error = 'Could not create account. Please check database configuration.';
        }
    }
}
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Strategy & Content Studio — Register</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;">Create Account</h2>
        <div style="margin-top:12px; font-size:12px; color:#9ca3af;">Join the studio to access workflows.</div>
    </aside>
    <div class="container">
        <div class="card" style="max-width: 520px;">
            <div class="hero hero-aws">
                <div class="title">Create your account</div>
                <div class="subtitle">Sign up to unlock guided strategies and content workflows.</div>
                <div class="cta-group">
                    <a class="button secondary" href="auth.php">Sign in</a>
                    <a class="button secondary" href="forgot.php">Forgot password</a>
                </div>
            </div>
            <?php if ($error): ?>
                <div class="notice error"><?php echo htmlspecialchars($error, ENT_QUOTES, 'UTF-8'); ?></div>
            <?php endif; ?>
            <form method="post">
                <div class="row"><input type="text" name="email" placeholder="Email" required></div>
                <div class="row"><input type="text" name="name" placeholder="Display name (optional)"></div>
                <div class="row"><input type="password" name="password" placeholder="Password" required></div>
                <div class="row"><input type="password" name="confirm" placeholder="Confirm password" required></div>
                <div class="row"><button type="submit">Create Account</button></div>
                <div class="config">Your password is stored as an MD5 hash in the users table.</div>
            </form>
        </div>
    </div>
</div>
</body>
</html>