Create your account

Start finding better opportunities today.

if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!verifyCsrf($_POST['csrf'] ?? '')) { $error = 'Invalid request. Please try again.'; } else { $name = trim($_POST['name'] ?? ''); $email = trim($_POST['email'] ?? ''); $password = $_POST['password'] ?? ''; $confirm = $_POST['confirm'] ?? ''; if (!$name || !$email || !$password || !$confirm) { $error = 'All fields are required.'; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $error = 'Please enter a valid email address.'; } elseif (strlen($password) < 8) { $error = 'Password must be at least 8 characters.'; } elseif ($password !== $confirm) { $error = 'Passwords do not match.'; } else { try { $hash = password_hash($password, PASSWORD_DEFAULT); q('INSERT INTO users (name, email, password_hash) VALUES (?, ?, ?)', [$name, $email, $hash]); $userId = (int)db()->lastInsertId(); session_regenerate_id(true); refreshSession($userId); header('Location: /profile.php'); exit; } catch (PDOException $e) { $error = ($e->getCode() === '23000') ? 'An account with that email already exists.' : 'Something went wrong. Please try again.'; } } } } $pageTitle = 'Create Account — Stagelevate'; require_once 'includes/header.php'; ?>
Stagelevate

Create your account

Start finding better gigs today. It's free.

Already have an account? Log in