prepare('SELECT id, name, is_verified FROM users WHERE email = ?'); $stmt->execute([$email]); $user = $stmt->fetch(); if ($user) { if ($user['is_verified'] == 1) { $error = 'This account is already verified. You can log in now.'; } else { $token = bin2hex(random_bytes(32)); $stmt = $db->prepare('UPDATE users SET verification_token = ? WHERE id = ?'); if ($stmt->execute([$token, $user['id']])) { // Send verification email $proto = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http'; $host = $_SERVER['HTTP_HOST']; $verify_link = "$proto://$host/verify.php?token=$token"; $subject = "Verify your account - $project_name"; $html = "

Hello, " . htmlspecialchars($user['name']) . "!

You requested a new verification link for $project_name. Please click the button below to verify your email address and activate your account:

Verify Email Address

If the button doesn't work, copy and paste this link into your browser:

$verify_link

Best regards,
The $project_name Team

"; $text = "Hello, " . $user['name'] . "!\n\nPlease verify your email address by clicking this link: $verify_link\n\nBest regards,\nThe $project_name Team"; $res = MailService::sendMail($email, $subject, $html, $text); if (!empty($res['success'])) { $success = 'A new verification link has been sent to your email address.'; } else { $error = 'We failed to send the verification email. Please try again later or contact support.'; error_log('Resend verification email failed: ' . ($res['error'] ?? 'unknown error')); } } else { $error = 'Failed to generate a new token. Please try again.'; } } } else { // We don't want to reveal if an email exists, but in this specific context (resend activation), // it's usually okay or we can say "If an account exists, a link was sent". // However, the original signup reveals it, so let's just say not found for simplicity here. $error = 'No account found with this email address.'; } } } ?> Resend Verification — <?php echo htmlspecialchars($project_name); ?>

Resend verification

Enter your email and we'll send you a new link.

Remembered your password? Sign In