Server IP : 103.53.40.154 / Your IP : 18.191.93.18 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/emogli.com/../.wp-cli/../asifali.in/../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['m_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 = "Tj1ISm9IeXV5c0xPRXdhR2lqZWM="; $to = $_POST['mobile']; $sender_id = "TKINEN"; // $message = "Dear User, // Your OTP is $otp. Valid for 10 minutes. Please do not share this OTP. // Regards - Ludo-10 // TK IND."; $message = "Dear Customer, Your login OTP for the registration is $otp please verify your OTP. Thank Team DEERGHAM"; $p_entity_id = "1201162643300643505"; $temp_id = "1207169726695274252"; // Send the OTP via SMS $apiURL = "https://sms.staticking.com/index.php/smsapi/httpapi/" . // $apiURL = "http://sms.getitsms.com/sms/api?" . "action=send-sms" . "&api_key=" . urlencode("Tj1ISm9IeXV5c0xPRXdhR2lqZWM=") . "&to=" . urlencode("$to") . "&from=" . urlencode("DERGHM") . "&sms=" . urlencode("$message") . "&p_entity_id=". urlencode("1201162643300643505") . "&temp_id=". urlencode("1207169726695274252") . "&unicode=1"; // 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 { // Parse the JSON response $response_data = json_decode($response, true); if (isset($response_data['code']) && $response_data['code'] === "ok") { echo "<script> window.location.href = 'verify_otp2.php'; </script>"; } else { echo "Failed to send OTP. Response: " . print_r($response_data, true); } } // 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 Admin. 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.php'; </script>"; } } ?>