prepare("SELECT id FROM users WHERE username = ? OR email = ?"); $stmt->execute([$username, $email]); if ($stmt->rowCount() > 0) { $error = t('user_exists'); } else { $hashed_password = password_hash($password, PASSWORD_DEFAULT); $verification_code = md5(uniqid(rand(), true)); $stmt = $pdo->prepare("INSERT INTO users (username, email, password, verification_code) VALUES (?, ?, ?, ?)"); if ($stmt->execute([$username, $email, $hashed_password, $verification_code])) { if (sendVerificationEmail($email, $username, $verification_code)) { $success = t('registration_success_verify'); } else { $pdo->prepare("UPDATE users SET is_verified = 1 WHERE email = ?")->execute([$email]); $success = t('registration_success_direct'); } } else { $error = t('registration_failed'); } } } } ?> <?php echo t('register'); ?> - <?php echo SITE_NAME; ?>