-
Notifications
You must be signed in to change notification settings - Fork 38
/
send-sms.php
155 lines (135 loc) · 4.95 KB
/
send-sms.php
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
<?php
/*********************************************************************
* Chan_Dongle SMS Script v.0.02
* for The Raspberry Asterisk
*
* Author: Troy Nahrwold
* Email: Troy(at)eternalworks(dot)com
* Company: Eternal Works
* Website: www.eternalworks.com
*
* Disclaimer:
* This product is solely a private production of the above named
* author, and is neither endorsed nor supported by Eternal Works.
* Although this product has been thuroughly tested, it is
* distributed AS IS, and the author assumes no liability for any
* damages this script may cause to your system. The author
* has provided full source code and encourages you to review the
* source code to determine any effects it may have on your system.
*
* (c) Copyright 2011, Troy A Nahrwold, Eternal Works, LLC.
* All Rights Reserved.
*
* Script design updated by:
* Matej Kovacic, https://telefoncek.si in 2023.
*
*********************************************************************/
$dongle = "dongle sms dongle0 ";
$ini = "'";
$password = '579b6757c7b4d23d354a11bb61d6339aaa87bdf2';
/* Defaut original password: '579b6757c7b4d23d354a11bb61d6339aaa87bdf2'; */
session_start();
if (!isset($_SESSION['loggedIn'])) {
$_SESSION['loggedIn'] = false;
}
if (isset($_POST['password'])) {
if (sha1($_POST['password']) == $password) {
$_SESSION['loggedIn'] = true;
} else {
die ('Incorrect password');
}
}
if (!$_SESSION['loggedIn']): ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Send SMS message from RasPBX</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="#f0d5b8" text="#ea7900" link="#262421" style="font-family: sans-serif">
<h2 align="center" style="color: #2b2a28">Login to send SMS message</h2>
<table border="5" cellspacing="0" cellpadding="1" width="600" bgcolor="#2b2a28" align="center">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="3" width="100%" bgcolor="#ffffff" align="center">
<tr>
<p> </p>
<form method="post">
Please enter your password: <input type="password" name="password"> <br />
<p></p>
</tr>
<p></td>
</tr>
<tr>
<td bgcolor="#2b2a28" align=right><input type="submit" name="submit" value="Login"></td>
</form>
</tr>
</table>
</td>
</tr>
</table>
<p>
</body>
</html>
<?php
exit();
endif;
if(isset($_REQUEST['phonenumbers']) && !empty($_REQUEST['phonenumbers']) && !empty($_REQUEST['message']))
{
$message = substr($_REQUEST['message'],0,160);
$phonenumberarray1 = explode(' ',$_REQUEST['phonenumbers']);
$phonenumberarray2 = array();
$phonenumberarray3 = array();
foreach ($phonenumberarray1 as $phonenumber)
{
$phonenumberarray2 = array_merge($phonenumberarray2,explode(',',$phonenumber));
}
foreach ($phonenumberarray2 as $phonenumber)
{
$phonenumberarray3 = array_merge($phonenumberarray3,explode("\n",$phonenumber));
}
$output = "Message: $message<br><br>\n";
foreach ($phonenumberarray3 as $phonenumber)
{
$runcommand = '/usr/sbin/asterisk -rx' . $ini . $dongle . $phonenumber . " " . $message . $ini;
$output .= "Sending message to: $phonenumber<br>\n";
exec($runcommand);
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Send SMS message from RasPBX</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="#f0d5b8" text="#ea7900" link="#262421" style="font-family: sans-serif">
<h2 align="center" style="color: #2b2a28">Send SMS message</h2>
<table border="5" cellspacing="0" cellpadding="1" width="600" bgcolor="#2b2a28" align="center">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="3" width="100%" bgcolor="#ffffff" align="center">
<tr bgcolor="#abcdef">
<td><b><?php echo $output; ?></b></td>
</tr>
<tr><form action="index.php" method="post">
<p><b>Phone number(s):</b> <br><font size="-2">(Format: NXXNXXXXXX. You can separate phone numbers with commas or newline.)</font></p>
<textarea id="phonenumbers" name="phonenumbers" rows="3" cols="30"></textarea>
<p><b>SMS message:</b> <br> <font size="-2">(Your message will be truncated to 160 characters.) </font></p>
<textarea id="message" name="message" size="160" rows="4" cols="50"></textarea><br /><br />
<button type="submit">Send SMS message</button><br /><br />
</form></tr>
</table>
</dd>
<p></td>
</tr>
<tr>
<td bgcolor="#2b2a28" align=right><a href="index.php"><button>Send another SMS message</button></a></td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</body>
</html>