[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: bulk-sms.php
<?php include("../admin/includes/functions/functions.php");?> <?php include("../admin/db/db.php");?> <?php if(!isset($_SESSION['username_Xw211qAAsq4'])) { header('Location: ../auth/'); exit(); } else{ $pageTitle1 = 'Send Bulk SMS'; $shopname = $_SESSION['business_name_Xw211qAAsq4']; $notificationType = "success"; $message = ""; $cnt = 1; $usersQuery = mysqli_query($new, "SELECT * FROM clients WHERE business_name = '$shopname' AND phone_number != 'N/A'"); $getsmsdata = mysqli_query($new, "SELECT * FROM sms_api WHERE shopname = '$shopname'"); $data = mysqli_fetch_array($getsmsdata); $username = $data['username']; $password = $data['password']; $senderID = $data['senderid']; if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!empty($_POST['numbers']) && !empty($_POST['message'])) { $selectedNumbers = $_POST['numbers']; // Array of selected numbers $message = $_POST['message']; foreach ($selectedNumbers as $dbnum) { $data = json_encode([ 'username' => $username, 'password' => $password, 'source' => $senderID, 'destination' => $dbnum, 'message' => $message, 'ol' => false, ]); $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://deywuro.com/api/sms', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPHEADER => [ 'Accept: application/json', 'Content-Type: application/json', ], ]); try { $response = curl_exec($curl); if (curl_errno($curl)) { $message = "Error sending to $dbnum: " . curl_error($curl) . "<br>"; } else { $message = "Message sent successfully"; } } catch (Throwable $th) { $message = "Error sending SMS: " . $th->getMessage() . "<br>"; } finally { curl_close($curl); } } } else { $message = "Please select at least one recipient and enter a message."; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title> <?php echo $shopname;?> - <?php echo $pageTitle1;?></title> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <link href="plugins/datatables/dataTables.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/responsive.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/buttons.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/select.bootstrap4.css" rel="stylesheet" type="text/css" /> <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script> <link rel="shortcut icon" href="../assets/icon.png" type="image/x-icon"> <link rel="icon" href="../assets/icon.png" type="image/x-icon"> <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/theme.min.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> <style> /* Styling for the textarea */ #messageBox { width: 100%; height: 150px; border-radius: 8px; padding: 12px; font-size: 16px; border: 1px solid #ccc; box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.1); resize: none; } #messageBox:focus { border-color: #428bca; outline: none; box-shadow: 2px 2px 12px rgba(66, 139, 202, 0.4); } /* Space between elements */ .form-control { margin-bottom: 10px; } .btn { border-radius: 6px; } </style> <script> function toggleSelectAll(source) { let checkboxes = document.querySelectorAll('input[name="numbers[]"]'); checkboxes.forEach(checkbox => checkbox.checked = source.checked); } function insertMessage() { let messageTemplates = { "thank_you": `Hello! \n\nThank you for choosing <?php echo $shopname; ?>. We appreciate your support and look forward to serving you again!\n\nBest regards, \n<?php echo $shopname; ?> Team.`, "promotion": ` Special Offer from <?php echo $shopname; ?>!\n\nEnjoy exclusive discounts on our services this week. Book now and save big!\n\nVisit us or call for more details!`, "appointment_reminder": ` Reminder: Your appointment with <?php echo $shopname; ?> is coming up soon!\n\nIf you need to reschedule, please contact us. Looking forward to seeing you!`, "custom": "" }; let selectedTemplate = document.getElementById("templateSelector").value; document.getElementById("messageBox").value = messageTemplates[selectedTemplate]; } </script> <style> .hidden-row { display: none !important; } </style> <script> let searchTimeout; function toggleSelectAll(source) { document.querySelectorAll('input[name="numbers[]"]').forEach(checkbox => { checkbox.checked = source.checked; }); } function liveSearch() { clearTimeout(searchTimeout); // Prevent multiple rapid calls searchTimeout = setTimeout(() => { let input = document.getElementById("searchInput").value.toLowerCase(); let rows = document.querySelectorAll("#customerTable tbody tr"); rows.forEach(row => { let phone = row.dataset.phone; row.classList.toggle("hidden-row", !phone.includes(input)); }); }, 200); // Debounced for performance } </script> </head> <body> <div id="preloader"> <div id="loader"></div> </div> <!-- Begin page --> <div id="layout-wrapper"> <div class="header-border"></div> <?php include("includes/template/head.php");?> <?php include("includes/template/side.php");?> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <!-- start page title --> <div class="row"> <div class="col-12"> <div class="page-title-box d-flex align-items-center justify-content-between"> <h4 class="mb-0 font-size-18">Send SMS </h4> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="javascript: void(0);"><?= $shopname;?></a></li> <li class="breadcrumb-item active"><?php echo $pageTitle1;?></li> </ol> </div> </div> </div> </div> <!-- end page title --> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-body"> <div class="container"> <h2 class="text-center">Send Bulk SMS</h2> <?php echo $message;?> <br /><br /> <form method="POST"> <div class="row"> <!-- Table Column --> <div class="col-md-6"> <div class="table-responsive"> <input type="text" id="searchInput" class="form-control mb-3" onkeyup="liveSearch()" placeholder="🔍 Search by phone number..."> <table id="customerTable" class="table table-striped table-bordered"> <thead style="background-color:#428bca; border:#428bca;"> <tr style="color: #ffffff;"> <th>#</th> <th>Phone</th> <th> <input type="checkbox" id="selectAll" onclick="toggleSelectAll(this)"> All </th> </tr> </thead> <tbody> <?php $cnt1 = 1; while ($user = mysqli_fetch_array($usersQuery)): ?> <tr data-phone="<?php echo strtolower($user['phone_number']); ?>"> <td><?php echo $cnt1++; ?></td> <td><?php echo $user['phone_number']; ?></td> <td> <input type="checkbox" name="numbers[]" value="<?php echo $user['phone_number']; ?>"> </td> </tr> <?php endwhile; ?> </tbody> </table> </div> </div> <!-- Message Box Column --> <div class="col-md-6"> <label for="templateSelector">Choose a Template:</label> <select id="templateSelector" class="form-control" onchange="insertMessage()"> <option value="custom">✍️ Write Your Own</option> <option value="thank_you">🙏 Thank You Message</option> <option value="promotion">🎉 Promotional Offer</option> <option value="appointment_reminder">📅 Appointment Reminder</option> </select> <textarea id="messageBox" name="message" class="form-control mt-3" rows="5" required></textarea> <br> <button type="submit" class="btn btn-success w-100">📩 Send SMS</button> </div> </div> </div> </form> </div> </div> </div> </div> <!--end card body--> </div> <!-- end card--> </div> <!-- end col --> </div> <!--end row--> </div> <!-- container-fluid --> </div> <!-- End Page-content --> <?php include("includes/template/newfooter.php");?> <!-- Overlay--> <div class="menu-overlay"></div> </body> </html> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/bootstrap.bundle.min.js"></script> <script src="assets/js/metismenu.min.js"></script> <script src="assets/js/waves.js"></script> <script src="assets/js/simplebar.min.js"></script> <script src="plugins/raphael/raphael.min.js"></script> <script src="assets/pages/dashboard-demo.js"></script> <script src="assets/js/theme.js"></script> <script src="assets/pages/datatables-demo.js"></script> <script type="text/javascript"> document.onreadystatechange = function() { if (document.readyState !== "complete") { document.querySelector("#preloader").style.display = "block"; } else { document.querySelector("#preloader").style.display = "none"; } }; </script> <!-- jQuery --> </body> </html>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.8 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002