OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
quiz
/
backup
/
process
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
check_user_exists.php
840 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
logged_out.php
132 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
loginCheck.php
1.17 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
sendOTP.php
2.51 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
showChildDetails.php
1.11 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
storeChildDetails.php
1.83 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
submitParentForm.php
2.03 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
verifyOtp.php
459 bytes
05/19/2025 10:07:16 AM
rw-r--r--
Editing: sendOTP.php
Close
<?php // sendOTP.php header('Content-Type: application/json'); include '../assets/php/mail.php'; session_start(); // Start session to store OTP for validation // Function to send OTP via SMS function sendSMSOTP($mobile, $otp) { // Simulated SMS sending logic (replace with actual API call) // Example: Use Twilio, Nexmo, or any SMS gateway API return "SMS sent to $mobile with OTP: $otp"; } // Function to send OTP via Email function sendEmailOTP($email, $otp) { // Create the HTML message $emailMessage = " <html> <head> <title>One Time Password (OTP) for Quiz Digantha</title> </head> <body> <p>Your One Time Password (OTP) for Quiz Digantha is:</p> <p><pre><strong>$otp</strong></pre></p> <br> <p>Regards,<br>Team Hosa Digantha</p> </body> </html> "; $emailSubject = 'One Time Password (OTP) for Quiz Digantha'; sendEmail('', $email, '', $emailSubject, $emailMessage); // Simulated Email sending logic (replace with actual email-sending logic) // Example: Use PHPMailer, SendGrid, or any email service return "Email sent to $email with OTP: $otp"; } // Capture POST variables $mobile = isset($_POST['mobile']) ? $_POST['mobile'] : null; $email = isset($_POST['email']) ? $_POST['email'] : null; $type = isset($_POST['type']) ? $_POST['type'] : null; // Validate input if ((!$email && !$mobile) || !$type) { $response = array( 'success' => false, 'message' => 'Invalid input. Mobile and type are required.' ); echo json_encode($response); exit; } // Generate a random 6-digit OTP $otp = rand(1000, 9999); // Store the OTP in the session for future use (optional) $_SESSION['otp'] = $otp; $_SESSION['mobile'] = $mobile; $_SESSION['type'] = $type; // Send OTP based on the type if ($type === 'sms') { $sendResult = sendSMSOTP($mobile, $otp); } elseif ($type === 'email') { $sendResult = sendEmailOTP($email, $otp); // Assuming mobile holds email if type is email } else { $response = array( 'success' => false, 'message' => 'Invalid type. Must be "sms" or "email".' ); echo json_encode($response); exit; } // Prepare the response $response = array( 'success' => true, 'message' => 'OTP generated and sent successfully.', 'details' => $sendResult // For testing purposes, include sending result (remove in production) ); // Send the JSON response echo json_encode($response);