OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
quiz
/
assets
/
php
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/15/2025 11:20:33 AM
rwxr-xr-x
📁
PHPMailer
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
checkEmailPhone.php
957 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
check_user_exists.php
1.23 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
db_config.php
344 bytes
05/19/2025 10:07:16 AM
rw-r--r--
📄
function.php
1.04 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
loginCheck.php
1.16 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
mail.php
2.01 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
sendOTP.php
3.73 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--
📄
submitCandidateForm.php
2.29 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
submitCandidate_copy.php
2.14 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--
📄
updateCandidateForm.php
1.53 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
updateCandidate_copy.php
2.34 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
validate.logged.php
1.31 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
validate_json.php
286 bytes
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 'mail.php'; session_start(); // Start session to store OTP for validation // Function to send OTP via SMS function sendSMSOTP($mobile, $otp) { $mobile_number = $mobile; $dlt_template_id = "1707173925008891714"; // DLT Template ID $api_key = "TzhvjiSEqhD"; // Replace with your 24x7SMS API key $sender_id = "Knobly"; // Replace with your registered Sender ID $service_name = "TEMPLATE_BASED"; // Replace with your service name (e.g., "Transactional" or "Promotional") // URL-encode the message+ $msg = 'Dear User, Your OTP to register for QuizDigantha ' . $otp . '. This is valid for only the next 15 minutes. Thank you for choosing to be a part of our journey towards excellence in truthful journalism.Please experience our channel and keep on letting us know what you think. QuizDigantha by Hosadigantha. -KNOBLY'; $message = urlencode($msg); // Construct the API URL for a single recipient $url = "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY={$api_key}&MobileNo={$mobile_number}&SenderID={$sender_id}&Message={$message}&ServiceName={$service_name}&DLTTemplateID={$dlt_template_id}"; // Initialize cURL session $ch = curl_init(); // Set cURL options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Execute the cURL request $output = curl_exec($ch); // Close the cURL session curl_close($ch); // Return response if ($output) { 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);