-
Notifications
You must be signed in to change notification settings - Fork 0
/
TwilioTest.php
executable file
·86 lines (77 loc) · 1.95 KB
/
TwilioTest.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
<?php
/*
Copyright © 2009,2015,2022 Siggi Bjarnason.
Licensed under GNU GPL v3 and later. Check out LICENSE.TXT for details
or see <https://www.gnu.org/licenses/gpl-3.0-standalone.html>
Page for testing Twilio SMS functionality
*/
require("header.php");
if($strReferer != $strPageURL and $PostVarCount > 0)
{
printPg("Invalid operation, Bad Reference!!!","error");
exit;
}
if(isset($_POST["txtNumber"]))
{
$strNumber = CleanReg(trim($_POST["txtNumber"]));
}
else
{
$strNumber ="";
}
if(isset($_POST["txtmsg"]))
{
$strMsg = CleanReg(trim($_POST["txtmsg"]));
}
else
{
$strMsg ="";
}
if(isset($_POST["btnSubmit"]))
{
$btnSubmit = $_POST["btnSubmit"];
}
else
{
$btnSubmit = "";
}
if($btnSubmit == "Submit")
{
$msg = $strMsg;
$number = $strNumber;
$response = SendTwilioSMS($msg,$number);
if($response[0])
{
printPg("Message successfully queued for sending","note");
}
else
{
printPg("A failure occured:","error");
$arrResponse = json_decode($response[1], TRUE);
$errmsg = "";
if(array_key_exists("message",$arrResponse))
{
$errmsg .= $arrResponse["message"];
}
if(array_key_exists("more_info",$arrResponse))
{
$errmsg .= " For more information see " . $arrResponse["more_info"];
}
printPg("$errmsg","error");
}
}
printPg("Twilio SMS test page","h1");
$TestWarn = $TextArray["TestSMS"];
printPg("Do not expose this page to the internet","alert");
printPg("$TestWarn","note");
print "<div class=SmallCenterBox>\n";
print "<form method=\"POST\">\n";
print "Phone number to send to:";
print "<input type=\"text\" name=\"txtNumber\" size=\"30\"><br>\n";
print "Message to send:";
print "<input type=\"text\" name=\"txtmsg\" size=\"30\"><br>\n";
print "<input type=\"submit\" value=\"Submit\" name=\"btnSubmit\">\n";
print "</form>\n";
print "</div>";
require("footer.php");
?>