forked from hsrai/GNDEC-SMS-Service
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sendsms.php
executable file
·180 lines (153 loc) · 5.9 KB
/
sendsms.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
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
<?php
/*************************************************************
* THE ADDRESS BOOK : version 1.04d
*
*************************************************************
*
* list.php
* Lists address book entries. This is the main page.
*
*************************************************************/
// ** GET CONFIGURATION DATA **
require_once('constants.inc');
require_once(FILE_FUNCTIONS);
require_once(FILE_CLASS_OPTIONS);
require_once(FILE_CLASS_CONTACTLIST);
require_once(FILE_CLASSES);
session_start();
// ** OPEN CONNECTION TO THE DATABASE **
$db_link = openDatabase($db_hostname, $db_username, $db_password, $db_name);
// ** CHECK FOR LOGIN **
checkForLogin();
// ** RETRIEVE OPTIONS THAT PERTAIN TO THIS PAGE **
$options = new Options();
// ** END INITIALIZATION *******************************************************
// CREATE THE LIST.
$list = new ContactList();
// THIS PAGE TAKES SEVERAL GET VARIABLES
// ie. list.php?group_id=6&page=2&letter=c&limit=20
if ($_GET['groupid']) $list->group_id = $_GET['groupid'];
if ($_GET['page']) $list->current_page = $_GET['page'];
if (isset($_GET['letter'])) $list->current_letter = $_GET['letter'];
if (isset($_GET['limit'])) $list->max_entries = $_GET['limit'];
// Set group name (group_id defaults to 0 if not provided)
$list->group_name();
// ** RETRIEVE CONTACT LIST BY GROUP **
$r_contact = $list->retrieve($_SESSION['username']);
$signature = strtoupper($_SESSION['username']);
echo "<link href='style.css' rel='stylesheet' type='text/css'>";
echo "<link rel='stylesheet' media='all' type='text/css' href='css/ui-lightness/jquery-ui-1.8.11.custom.css' />";
echo "<script type='text/javascript' src='jquery-1.5.min.js'></script>";
echo "<script type='text/javascript' src='jquery_ui.js'></script>";
echo "<script type='text/javascript' src='datetime.js'></script>";
echo "<script>
$(document).ready(function(){
$('#dt').datetimepicker({dateFormat:'yy-mm-dd',
showSecond:true,
timeFormat: 'hh:mm:ss',
separator: ','});
});
</script>";
?>
<HTML>
<HEAD>
<TITLE><?php echo "$lang[TITLE_TAB] - $lang[TITLE_LIST]"?></TITLE>
<LINK REL="stylesheet" HREF="styles.css" TYPE="text/css">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="-1">
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['CHARSET']?>">
<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
} else {
limitCount.value = limitNum - limitField.value.length;
}
}
</script>
</HEAD>
<BODY onLoad="document.goToEntry.goTo.focus();">
<A NAME="top"></A>
<P>
<CENTER>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=570>
<TR><TD><IMG SRC="images/title.png" WIDTH=570 HEIGHT=90 ALT="" BORDER=0></TD></TR>
<TR>
<TD>
<?php
if(isset($_POST['schedule'])) {
echo "<table><form action='insert.php' method='post'>";
echo "<tr><td></td><td>For multiple Numbers Use , to separate</td></tr>";
echo "<tr><td>Enter Number</td><td><input type='text' name='mobile' /></td></tr>";
echo "<tr><td>Message</td><td><textarea name='msgdata' rows='10' cols='40' onKeyDown='limitText(this.form.msgdata,this.form.countdown,140)'
onKeyUp='limitText(this.form.limitedtextarea,this.form.countdown,140)'>
</textarea></td></tr>
<tr><td><font size='1'>(Maximum characters: 140)</td></td>
<tr><td>You have</td><td><input readonly type='text' name='countdown' size='3' value='140'> characters left.</td></tr>";
echo "<tr><td>Time</td><td><input type='text' name='datetime' id='dt' /></td></tr>";
echo "<input type='hidden' name='schedule' id='sch' />";
echo "<tr><td><input type='submit' value='Schedule'/></td></form>";
echo "<td><form action='list.php' method='post'><input type='submit' value='Go Back'/></form></td></tr></table>";
}
else {
$sql ="SELECT fullname FROM users WHERE username='".$_SESSION['username']."'";
$sql2 ="SELECT mobile FROM users WHERE username='".$_SESSION['username']."'";
$result = mysql_query($sql);
$result2 = mysql_query($sql2);
$fullname = mysql_fetch_array($result);
$mobileno = mysql_fetch_array($result2);
$nos=str_replace("-","",$_POST['phone']);
if(isset($_POST['resend'])){
$nos = $_POST['resend_mobile'];
}
?>
<?php
echo "<form action='insert.php' method='post'>";
echo "Enter Number <input type='text' name='receiver' value='".$nos."' />";
?>
<br>
Enter Message
<br>
<?php if(isset($_POST['resend'])){?>
<textarea name="msgdata" rows="10" cols="40" onKeyDown="limitText(this.form.msgdata,this.form.countdown,140);"
onKeyUp="limitText(this.form.limitedtextarea,this.form.countdown,140);">
<?php echo $_POST['resend_msgdata']; ?>
</textarea><br>
<font size="1">(Maximum characters: 140)<br>
You have <input readonly type="text" name="countdown" size="3" value="140"> characters left.</font>
<br /><br>
<?php }
else
{?>
<textarea name="msgdata" rows="10" cols="40" onKeyDown="limitText(this.form.msgdata,this.form.countdown,140);"
onKeyUp="limitText(this.form.limitedtextarea,this.form.countdown,140);">---
Sender :- <?php echo $fullname[0]; ?>
Mobile :- <?php echo $mobileno[0]; ?>
</textarea><br>
<font size="1">(Maximum characters: 140)<br>
You have <input readonly type="text" name="countdown" size="3" value="140"> characters left.</font>
<br /><br>
<?php
} ?>
</td></tr>
<tr><td>
<center><table>
<tr><td valign='top'>
<input type="image" src="images/send_sms.png" />
</form>
</td>
<td valign='top'>
<form action="list.php" method="post">
<input type="image" src="images/addressbook.png" />
</form></td>
</td><td valign='top'>
<form action="student_search.php" method="post">
<input type="image" src="images/student1.png" />
</form></td>
</tr></table></center>
</td></tr></table>
<b><p style="color:#07260e">Note: Replies to this number are not monitored yet.</p>
</body>
</html>
<?php } ?>