-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathresend_otp.php
More file actions
25 lines (20 loc) · 786 Bytes
/
resend_otp.php
File metadata and controls
25 lines (20 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
require_once('includes/load.php');
require_once('includes/email_functions.php');
// Check if there's a pending verification
if(!isset($_SESSION['temp_purchase_request'])) {
redirect('customer_view.php', false);
}
$request_data = $_SESSION['temp_purchase_request'];
// Generate new OTP
$otp = rand(100000, 999999);
$_SESSION['purchase_otp'] = $otp;
$_SESSION['otp_time'] = time(); // Reset the OTP time
// Send OTP to customer email
if(send_otp_email($request_data['email'], $request_data['customer_name'], $otp)) {
$_SESSION['success'] = "A new verification code has been sent to your email.";
} else {
$_SESSION['error'] = "Failed to send verification code. Please try again.";
}
redirect('verify_purchase.php', false);
?>