-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsenrush.php
More file actions
333 lines (306 loc) · 13.9 KB
/
Copy pathsenrush.php
File metadata and controls
333 lines (306 loc) · 13.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<?php
session_start();
/* === CONFIGURATION === */
$clicksendUsername = 'payclick67@gmail.com'; // your ClickSend account email
$clicksendApiKey = '50718719-64D3-3C98-DD43-EE3123D1D33C'; // your ClickSend API key
$veriphoneApiKey = '4156B7EA97C44284B86BF81D5C5D3CF2'; // your Veriphone API key
/* === Carrier Email Placeholders (for preview only) === */
$carrierGateways = [
"att" => ["label" => "AT&T", "gateway" => "txt.att.net"],
"tmobile" => ["label" => "T-Mobile", "gateway" => "tmomail.net"],
"verizon" => ["label" => "Verizon", "gateway" => "vtext.com"],
"sprint" => ["label" => "Sprint", "gateway" => "messaging.sprintpcs.com"],
"boost" => ["label" => "Boost Mobile", "gateway" => "sms.myboostmobile.com"],
"cricket" => ["label" => "Cricket", "gateway" => "sms.cricketwireless.net"],
"metropcs" => ["label" => "MetroPCS", "gateway" => "mymetropcs.com"],
"uscellular" => ["label" => "U.S. Cellular", "gateway" => "email.uscc.net"],
"virgin" => ["label" => "Virgin Mobile", "gateway" => "vmobl.com"],
"googlefi" => ["label" => "Google Fi", "gateway" => "msg.fi.google.com"],
"tracfone" => ["label" => "Tracfone", "gateway" => "mmst5.tracfone.com"],
"straighttalk" => ["label" => "Straight Talk", "gateway" => "vtext.com"],
"pageplus" => ["label" => "Page Plus", "gateway" => "vtext.com"]
];
/* === AJAX VALIDATION HANDLER === */
if (isset($_GET['validate'])) {
header('Content-Type: application/json');
$phone = preg_replace('/\D/', '', $_GET['phone'] ?? '');
if (empty($phone)) {
echo json_encode(['valid' => false, 'message' => '❌ Enter a valid number']);
exit;
}
$apiUrl = "https://api.veriphone.io/v2/verify?key={$veriphoneApiKey}&phone=" . urlencode($phone);
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($response === false || !empty($error)) {
echo json_encode(['valid' => false, 'message' => '⚠️ API connection error: ' . $error]);
exit;
}
$data = json_decode($response, true);
if (empty($data['phone_valid'])) {
echo json_encode(['valid' => false, 'message' => '❌ Invalid number']);
exit;
}
$carrierName = $data['carrier'] ?? 'Unknown';
echo json_encode([
'valid' => true,
'message' => "✅ Number valid ({$carrierName})",
'carrier' => $carrierName
]);
exit;
}
/* === MAIN MESSAGE HANDLER === */
$feedback = "";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$number = preg_replace('/\D/', '', $_POST['phone'] ?? '');
$message = trim($_POST['message'] ?? '');
$carrierKey = $_POST['carrier'] ?? '';
if (empty($number) || strlen($number) < 10 || empty($message)) {
$feedback = "⚠️ Invalid number or message.";
} else {
$status = 'failed';
// ✅ Send SMS via ClickSend API
$payload = [
'messages' => [[
'source' => 'php',
'body' => $message,
'to' => '+' . $number,
'schedule' => '',
'custom_string' => 'SMS-Gateway-System'
]]
];
$ch = curl_init("https://rest.clicksend.com/v3/sms/send");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_USERPWD, "{$clicksendUsername}:{$clicksendApiKey}");
$response = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
// 🧠 Interpret ClickSend feedback
if ($response === false || !empty($error)) {
$feedback = "❌ ClickSend API Error: " . htmlspecialchars($error);
} else {
$result = json_decode($response, true);
$msg = $result['data']['messages'][0] ?? [];
$statusCode = strtoupper($msg['status'] ?? '');
$responseCode = $result['response_code'] ?? '';
$carrierName = $msg['carrier'] ?? 'Unknown';
if (in_array($statusCode, ['DELIVERED', 'SUCCESS'])) {
$feedback = "✅ Message successfully delivered to +{$number}";
$status = 'sent';
} elseif (in_array($statusCode, ['QUEUED', 'PENDING'])) {
$feedback = "⏳ Message queued for delivery to +{$number}";
$status = 'queued';
} elseif ($statusCode === 'REGISTRATION_NEEDED') {
$feedback = "⚠️ SenRush developer working on sms-email-gateway, message accepted but on hold";
$status = 'restricted';
} elseif ($responseCode === 'SUCCESS') {
$feedback = "✅ Message accepted by ClickSend (processing for delivery).";
$status = 'accepted';
} else {
$feedback = "⚠️ API Response: " . htmlspecialchars(json_encode($result));
}
}
// ✅ Save to session history
if (!isset($_SESSION['sms_history'])) $_SESSION['sms_history'] = [];
$entry = [
'time' => date('Y-m-d H:i:s'),
'to' => '+' . $number,
'carrier' => $carrierName ?? 'Unknown',
'message' => $message,
'status' => $status
];
array_unshift($_SESSION['sms_history'], $entry);
$_SESSION['sms_history'] = array_slice($_SESSION['sms_history'], 0, 20);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>SenRush SMS Gateway — Dark UI</title>
<style>
:root {
--bg1: #08121a;
--bg2: #0f2430;
--card: rgba(20, 24, 30, 0.85);
--accent1: #00c6ff;
--accent2: #0072ff;
--muted: #9aa6b2;
}
* { box-sizing: border-box; }
body {
margin:0;min-height:100vh;
font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
background: radial-gradient(1200px 600px at 5% 10%, rgba(0,198,255,0.06), transparent),
linear-gradient(135deg, var(--bg1), var(--bg2));
color: #ecf3f8;
display:flex;align-items:center;justify-content:center;
padding:20px;
}
.wrap {
width: 980px;max-width: calc(100% - 40px);
display:grid;grid-template-columns: 1fr 420px;
gap: 24px;align-items:start;
animation: popIn .7s cubic-bezier(.2,.9,.3,1);
}
.card {
background: var(--card);border-radius: 14px;padding: 22px;
box-shadow: 0 8px 30px rgba(2,8,20,0.6);
backdrop-filter: blur(6px) saturate(120%);
border: 1px solid rgba(255,255,255,0.03);
}
h1 {margin:0 0 8px;font-size:20px;display:flex;align-items:center;gap:10px;}
.subtitle { color:var(--muted); font-size:13px; margin-bottom:16px; }
form label { display:block;font-size:13px;color:var(--muted);margin-top:12px; }
input,textarea,select {
width:100%;padding:12px;margin-top:8px;
border-radius:10px;border: 1px solid rgba(255,255,255,0.04);
background: rgba(255,255,255,0.02);color: #eaf6ff;
outline:none;font-size:14px;
}
textarea{resize:vertical;}
.preview{margin-top:10px;font-size:13px;color:var(--muted);display:flex;justify-content:space-between;}
.send-btn {
margin-top:14px;width:100%;padding:12px;border-radius:10px;border:none;cursor:pointer;
background: linear-gradient(90deg, var(--accent1), var(--accent2));
color:#032233;font-weight:700;font-size:15px;
box-shadow: 0 10px 30px rgba(0,120,255,0.12);
}
.send-btn:hover { transform: translateY(-3px); }
.feedback {margin-top:12px;padding:10px;border-radius:8px;background:rgba(0,0,0,0.3);}
.history-title {display:flex;justify-content:space-between;align-items:center;}
.history-list {margin-top:12px;max-height:520px;overflow:auto;}
.history-item {padding:10px;border-radius:10px;margin-bottom:10px;background:rgba(255,255,255,0.02);}
.meta {color:var(--muted);font-size:12px;margin-bottom:6px;display:flex;justify-content:space-between;}
.status-sent {color:#9ce6a2;font-weight:700;}
.status-failed {color:#ff9b9b;font-weight:700;}
.charcount {font-size:12px;color:var(--muted);margin-left:6px;}
@keyframes popIn {from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.auto-type{
text-align: center;
font-family: comic sans ms;
opacity: 0.7;
}
@media (max-width: 768px) {
body {
padding: 15px;
}
.wrap {
grid-template-columns: 1fr; /* stack vertically */
gap: 16px;
}
.card {
padding: 18px;
}
h1 {
font-size: 18px;
}
input, textarea, select, .send-btn {
font-size: 14px;
padding: 10px;
}
.history-list {
max-height: 300px; /* reduce height so it fits */
}
}
</style>
</head>
<body>
<div class="wrap">
<div class="card">
<center><span class="auto-type"></span></center><br>
<h1>📩 SenRush SMS Gateway</h1>
<div class="subtitle">Enter a 10-digit U.S. number, select carrier, type your message.</div>
<form method="POST" novalidate>
<label>Phone Number</label>
<input type="text" name="phone" id="phone" placeholder="e.g. 5551234567" required>
<button type="button" id="checkBtn" class="send-btn" style="margin-top:8px;background:linear-gradient(90deg,#555,#333);">Check Number</button>
<div id="checkResult" style="margin-top:6px;font-size:13px;color:#ccc;"></div>
<label>Carrier</label>
<select name="carrier" id="carrier" required>
<?php foreach ($carrierGateways as $key => $info): ?>
<option value="<?php echo $key; ?>"><?php echo htmlspecialchars($info['label']); ?></option>
<?php endforeach; ?>
</select>
<div class="preview">To: <span id="previewText">5551234567@vtext.com</span></div>
<label>Message <span class="charcount" id="charCount">0/160</span></label>
<textarea name="message" id="message" rows="5" maxlength="160" required></textarea>
<button class="send-btn" id="sendBtn" type="submit" disabled>Send Message</button>
<?php if (!empty($feedback)): ?><div class="feedback"><?php echo $feedback; ?></div><?php endif; ?>
</form>
</div>
<div class="card">
<div class="history-title"><strong>Recent Sends</strong></div>
<div class="history-list">
<?php
$history = $_SESSION['sms_history'] ?? [];
if (empty($history)) {
echo '<div class="history-item" style="text-align:center;color:var(--muted)">No messages yet.</div>';
} else {
foreach ($history as $h) {
$statusClass = $h['status'] === 'sent' ? 'status-sent' : 'status-failed';
echo '<div class="history-item">';
echo '<div class="meta"><div>' . htmlspecialchars($h['time']) . ' — ' . htmlspecialchars($h['carrier']) . '</div><div class="' . $statusClass . '">' . htmlspecialchars($h['status']) . '</div></div>';
echo '<div><strong>To:</strong> ' . htmlspecialchars($h['to']) . '</div>';
echo '<div style="white-space:pre-wrap;line-height:1.35;">' . htmlspecialchars($h['message']) . '</div>';
echo '</div>';
}
}
?>
</div>
</div>
</div>
<script>
const phone=document.getElementById('phone');
const carrier=document.getElementById('carrier');
const preview=document.getElementById('previewText');
const message=document.getElementById('message');
const count=document.getElementById('charCount');
const checkBtn=document.getElementById('checkBtn');
const checkResult=document.getElementById('checkResult');
const sendBtn=document.getElementById('sendBtn');
const map={<?php foreach($carrierGateways as $k=>$v){echo "'$k':'{$v['gateway']}',";}?>};
function updatePreview(){
const p=(phone.value||'').replace(/\D/g,'');
const c=carrier.value;
preview.textContent=(p?p:'5551234567')+'@'+(map[c]||'vtext.com');
}
function updateCount(){count.textContent=message.value.length+'/160';}
checkBtn.addEventListener('click',()=>{
const num=phone.value.trim();
if(num.length<10){checkResult.textContent="❌ Enter at least 10 digits.";checkResult.style.color="red";return;}
checkResult.textContent="⏳ Checking number...";checkResult.style.color="gray";
fetch(`?validate=1&phone=${encodeURIComponent(num)}`)
.then(r=>r.json())
.then(d=>{
if(!d.valid){checkResult.textContent=d.message;checkResult.style.color="red";sendBtn.disabled=true;}
else{
checkResult.textContent=d.message;
checkResult.style.color="lightgreen";
if(d.carrier_key && carrier.querySelector(`option[value="${d.carrier_key}"]`)) carrier.value=d.carrier_key;
sendBtn.disabled=false;
updatePreview();
}
})
.catch(()=>{checkResult.textContent="⚠️ Error contacting API.";checkResult.style.color="orange";sendBtn.disabled=true;});
});
phone.addEventListener('input',updatePreview);
carrier.addEventListener('change',updatePreview);
message.addEventListener('input',updateCount);
updatePreview();updateCount();
</script>
<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.12"></script>
<script>
new Typed('.auto-type',{strings:['With Senrush-sms.live platform','Enjoy Unlimited Texting','Without Blockage'],typeSpeed:30,backSpeed:30,loop:true});
</script>
</body>
</html>