| Current Path : /home/users/unlimited/www/nigeria.codeskitter.site/ |
| Current File : /home/users/unlimited/www/nigeria.codeskitter.site/resend_otp.php |
<?php
include 'config.php';
session_start();
if(isset($_POST['email'])) {
$email = $_POST['email'];
// Generate new OTP
$otp = rand(100000, 999999);
$_SESSION['otp_code'] = $otp;
$_SESSION['otp_expiry'] = time() + (10 * 60); // OTP valid for 10 minutes
// Send OTP email
$subject = "Verify Your Email - Gex Neural Academy";
$message = "
<html>
<head>
<title>Email Verification</title>
</head>
<body>
<h2>Welcome to Gex Neural Academy!</h2>
<p>Your new OTP code for email verification is: <strong>$otp</strong></p>
<p>This code will expire in 10 minutes.</p>
<p>If you didn't request this, please ignore this email.</p>
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= "From: no-reply@gexneuralacademy.com" . "\r\n";
if(mail($email, $subject, $message, $headers)) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['success' => false]);
}
} else {
echo json_encode(['success' => false]);
}
?>