forked from LightsOnHudson/FPP-Plugin-TwilioControl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
messageManagement.php
executable file
·580 lines (421 loc) · 17.5 KB
/
messageManagement.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
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
<?php
//$DEBUG=true;
include_once "/opt/fpp/www/common.php";
include_once("/opt/fpp/www/config.php");
include_once 'functions.inc.php';
include_once 'commonFunctions.inc.php';
$pluginName = "TwilioControl";
$TwilioVersion = "2.0";
$messageQueue_Plugin = "MessageQueue";
$MESSAGE_QUEUE_PLUGIN_ENABLED=false;
$logFile = $settings['logDirectory']."/".$pluginName.".log";
$pluginConfigFile = $settings['configDirectory'] . "/plugin." .$pluginName;
if (file_exists($pluginConfigFile))
$pluginSettings = parse_ini_file($pluginConfigFile);
$messageQueuePluginPath = $settings['pluginDirectory']."/".$messageQueue_Plugin."/";
$DEBUG=urldecode($pluginSettings['DEBUG']);
if(file_exists($messageQueuePluginPath."functions.inc.php"))
{
include $messageQueuePluginPath."functions.inc.php";
$MESSAGE_QUEUE_PLUGIN_ENABLED=true;
} else {
logEntry("Message Queue Plugin not installed, some features will be disabled");
}
$blacklistFile = $settings['configDirectory']."/plugin.".$pluginName.".Blacklist";
$delBlacklistNumber=null;
$blacklistNumber=null;
$messageText=null;
$gitURL = "https://github.com/LightsOnHudson/FPP-Plugin-TwilioControl.git";
// set up DB connection
// set up DB connection
$Plugin_DBName = $settings['configDirectory']."/FPP.".$pluginName.".db";
//echo "PLUGIN DB:NAME: ".$Plugin_DBName;
$db = new SQLite3($Plugin_DBName) or die('Unable to open database');
$messageQueueFile = urldecode(ReadSettingFromFile("MESSAGE_FILE",$messageQueue_Plugin));
logEntry("TWILIO MESSAGE MANAGEMENT: ".$messageQueueFile);
$blacklistFile = $settings['configDirectory']."/plugin.".$pluginName.".Blacklist";
$profanityMessageQueueFile = $settings['configDirectory']."/plugin.".$pluginName.".ProfanityQueue";
$TSMS_account_sid = urldecode($pluginSettings['TSMS_ACCOUNT_SID']);
$TSMS_auth_token = urldecode($pluginSettings['TSMS_AUTH_TOKEN']);
$TSMS_phoneNumber = urldecode($pluginSettings['TSMS_PHONE_NUMBER']);
$CONTROL_NUMBERS = urldecode ( $pluginSettings ['CONTROL_NUMBERS'] );
$WHITELIST_NUMBERS = urldecode ( $pluginSettings ['WHITELIST_NUMBERS'] );
$CONTROL_NUMBER_ARRAY = explode ( ",", $CONTROL_NUMBERS );
$WHITELIST_NUMBER_ARRAY = explode ( ",", $WHITELIST_NUMBERS );
$REFRESH_SECONDS = 5;
$REFRESH_PAGE = "http://".$_SERVER['SERVER_ADDR']."/plugin.php?plugin="."TwilioControl"."&page=messageManagement.php&REFRESH=true&AUTO_REFRESH=ON";
if(isset($_GET['REFRESH']) && isset($_GET['AUTO_REFRESH'])) {
?>
<html>
<head>
<meta http-equiv="refresh" content="<?php echo $REFRESH_SECONDS?>;URL='<?php echo $_GET['REFRESH_PAGE']?>'">
</head>
<body>
<?php
echo "Watch the page reload itself in 10 second!";
}
if($DEBUG) {
print_r ($_POST);
}
if($DEBUG) {
print_r($_GET);
}
if(isset($_POST['delMessageQueue'])) {
//delete message queue
//$db = new SQLite3($DB_NAME) or die('Unable to open database');
$deleteMessageQueue = "DELETE FROM messages";
logEntry("TWILIO MESSAGE MANAGEMENT: Deleting TwilioControl messages from message queue file ".$deleteMessageQueue);
$deleteTwilioMessageQueueResult = $db->query($deleteMessageQueue) or die('Unable to delete Twilio Message Table');
}
if(isset($_POST['delProfanityQueue'])) {
//delete message queue
//$db = new SQLite3($DB_NAME) or die('Unable to open database');
$deleteMessageQueue = "DELETE FROM profanity";
logEntry("TWILIO MESSAGE MANAGEMENT: Deleting TwilioControl messages from profanity queue file ".$deleteMessageQueue);
$deleteTwilioMessageQueueResult = $db->query($deleteMessageQueue) or die('Unable to delete Twilio Profanity Message Table');
}
if(isset($_POST['delBlacklistQueue'])) {
//delete message queue
//$db = new SQLite3($DB_NAME) or die('Unable to open database');
$deleteMessageQueue = "DELETE FROM blacklist";
logEntry("TWILIO MESSAGE MANAGEMENT: Deleting TwilioControl messages from blacklist queue file ".$deleteMessageQueue);
$deleteTwilioMessageQueueResult = $db->query($deleteMessageQueue) or die('Unable to delete Twilio Blacklist message Table');
}
if(isset($_POST['removeProfanity'])) {
logEntry("Removing a profanity list number");
$delProfanityNumber=$_POST['phoneNumber'];
$messageText=$_POST['messageText'];
$messageTimestamp = $_POST['timestamp'];
//$messageID = $_POST['messageID'];
//$db = new SQLite3($DB_NAME) or die('Unable to open database');
$deleteProfanityMessageQuery = "DELETE FROM profanity WHERE pluginData = '".$delProfanityNumber."' AND timestamp ='".$messageTimestamp."'";
logEntry("TWILIO MESSAGE MANAGEMENT: Delete profanity query: ".$deleteProfanityMessageQuery);
$deleteProfanityMessageResult = $db->query($deleteProfanityMessageQuery) or die('Query failed');
//load file into $fc array
//$db.close();
}
if(isset($_POST['sendStandardReply'])) {
$replyToNumber=urldecode($_POST['phoneNumber']);
$normalReply=urldecode($_POST['normalReply']);
$messageID = $_POST['messageID'];
$TSMS_from = $replyToNumber;
if(substr($TSMS_from, 0) != "+") {
$TSMS_from = "+".$TSMS_from;
}
logEntry("Sending a reply ".$normalReply." to phone number: ".$TSMS_from);
sendTSMSMessage($normalReply);
}
if(isset($_POST['sendReply'])) {
$blacklistNumber=urldecode($_POST['phoneNumber']);
$profanityReply=urldecode($_POST['profanityReply']);
$messageID = $_POST['messageID'];
$TSMS_from = $blacklistNumber;
if(substr($TSMS_from, 0) != "+") {
$TSMS_from = "+".$TSMS_from;
}
logEntry("Sending a reply ".$profanityReply." to phone number: ".$TSMS_from);
sendTSMSMessage($profanityReply);
}
if(isset($_POST['addBlacklist'])) {// != "") {
logEntry("Adding a blacklist number");
$blacklistNumber=$_POST['phoneNumber'];
$messageText=$_POST['messageText'];
$messageID = $_POST['messageID'];
if($DEBUG) {
echo "Black listing phone number: ID: ".$messageID." number: ".$blacklistNumber. " text: ".$messageText."<br/> \n";
}
//$blacklistNumber = $_POST['phoneNumber'];
//$messageText = $_POST['messageText'];
//addBlacklist($messageText,$pluginName,$blacklistNumber);
insertBlacklistMessage ( $messageText, $pluginName, $blacklistNumber );
//echo "Number: ".$blacklistNumber." added to ".$pluginName." Blacklist with message: ".$messageText;
}
if(isset($_POST['delBlacklist'])) {// != "") {
logEntry("Removing a blacklist number");
$delBlacklistNumber=$_POST["phoneNumber"];
$messageText=$_POST['messageText'];
$messageID = $_POST['messageID'];
$messageTimestamp = $_POST['timestamp'];
//$messageID = $_POST['messageID'];
//$db = new SQLite3($DB_NAME) or die('Unable to open database');
//delete from blacklist all entries of that number!
$deleteBlacklistQuery = "DELETE FROM blacklist WHERE pluginData = '".$delBlacklistNumber."'";// AND timestamp ='".$messageTimestamp."'";
logEntry("TWILIO MESSAGE MANAGEMENT: Delete blacklist query: ".$deleteBlacklistQuery);
$deleteBlacklistQueryResult = $db->query($deleteBlacklistQuery) or die('Query failed');
}
if(isset($_GET['START'])) {
$CURRENT_DAY_START_TIMESTAMP = $_GET['START'];
} else {
$CURRENT_DAY_START_TIMESTAMP = mkTimestamp(date("Y"),date("m"),date("d"),0,0,0);
}
if(isset($_GET['END'])) {
$CURRENT_DAY_END_TIMESTAMP = $_GET['END'];
} else {
$CURRENT_DAY_END_TIMESTAMP = mkTimestamp(date("Y"),date("m"),date("d"), 23,59,59);
}
//duplicate from above!
// $db = new SQLite3($Plugin_DBName) or die('Unable to open database');
//$messagesQuery = "SELECT * FROM messages WHERE pluginName = '".$pluginName."' ORDER BY timestamp DESC";
echo "<br/> \n";
echo "<a href=\"http://".$_SERVER['SERVER_ADDR']."/plugin.php?plugin=".$pluginName."&page=exportMessages.php&nopage=1\">EXPORT Messages</a> \n";
echo "     \n";
echo "<a href=\"http://".$_SERVER['SERVER_ADDR']."/plugin.php?plugin=".$pluginName."&page=messageManagement.php&START=".($CURRENT_DAY_START_TIMESTAMP-86400)."&END=".($CURRENT_DAY_END_TIMESTAMP-86400)."\">Previous Day</a> \n";
echo "     \n";
echo "<a href=\"http://".$_SERVER['SERVER_ADDR']."/plugin.php?plugin=".$pluginName."&page=messageManagement.php&START=".($CURRENT_DAY_START_TIMESTAMP+86400)."&END=".($CURRENT_DAY_END_TIMESTAMP+86400)."\">Next Day</a> \n";
echo "<br/> \n";
//put the links as form links to go backwards and forwards to see messages
//ability to EXPORT messages as CSV
$messagesQuery = "SELECT * FROM messages WHERE pluginName = '".$pluginName."' AND timestamp > ".$CURRENT_DAY_START_TIMESTAMP." AND timestamp < ".$CURRENT_DAY_END_TIMESTAMP." ORDER BY timestamp DESC";
$messagesResult = $db->query($messagesQuery) or die('Query failed');
echo "<center><h1><b>".$pluginName." Message Management</b></h1></center> <br/> \n";
echo "<hr> \n";
echo "<center><h2><b>ALL Messages (Latest on top)</b></h2> \n";
echo "<br/> \n";
echo date('d M Y H:i:s',$CURRENT_DAY_START_TIMESTAMP)." thru ".date('d M Y H:i:s',$CURRENT_DAY_END_TIMESTAMP)."</center> <br/> \n";
//echo "<textarea class=\"FormElement\" name=\"messages\" id=\"messages\" cols=\"40\" rows=\"".$messageCount."\">\n";
echo "<table cellspacing=\"3\" cellpadding=\"3\" border=\"1\"> \n";
echo "<tr> \n";
echo "<td> \n";
echo "LEGEND \n";
echo "</td> \n";
echo "<td bgcolor=\"yellow\"> \n";
echo "CONTROL/WHITELIST Number \n";
echo "</td> \n";
echo "<td bgcolor=\"red\"> \n";
echo "Blacklisted Number \n";
echo "</td> \n";
echo "</tr> \n";
echo "<tr> \n";
echo "<td> \n";
echo "Date Received \n";
echo "</td> \n";
echo "<td align=\"center\"> \n";
echo "Message \n";
echo "</td> \n";
echo "<td> \n";
echo "From number \n";
echo "</td> \n";
echo "<td align=\"center\"> \n";
echo "Options \n";
echo "</td> \n";
echo "<td align=\"center\"> \n";
echo "Send reply \n";
echo "</td> \n";
echo "</tr> \n";
while ($row = $messagesResult->fetchArray()) {
echo "<form name=\"messageManagementBlacklist\" method=\"post\" action=\"http://".$_SERVER['SERVER_ADDR']."/plugin.php?plugin=".$pluginName."&page=messageManagement.php\"> \n";
//check if blacklisted..
//$blackListCheck = checkBlacklistNumber($row['pluginData']);
//returns null if not found
$blackListCheck = checkBlacklist($row['pluginData']);
if($DEBUG) {
logEntry("TWILIO MESSAGE MANAGEMENT: Returned blaklist check: ".$blackListCheck);
}
if (in_array ( $row['pluginData'], $CONTROL_NUMBER_ARRAY )) {
$TR = "yellow";
}elseif (in_array ( $row['pluginData'], $WHITELIST_NUMBER_ARRAY )) {
$TR = "yellow";
}elseif($blackListCheck != null) {
$TR = "red";
} else {
$TR="";
}
echo "<tr bgcolor=\"".$TR."\"> \n";
//unix timestamp
echo "<td> \n";
echo date('d M Y H:i:s',$row['timestamp']);
echo "<input type=\"hidden\" name=\"timestamp\" value=\"".$row['timestamp']."\"> \n";
echo "</td> \n";
echo "<td> \n";
//message data
echo urldecode($row['message']);
echo "<input type=\"hidden\" name=\"messageText\" value=\"".trim($row['message'])."\"> \n";
echo "</td> \n";
echo "<td> \n";
//message data
echo $row['pluginData'];
echo "<input type=\"hidden\" name=\"phoneNumber\" value=\"".trim($row['pluginData'])."\"> \n";
echo "</td> \n";
echo "<input type=\"hidden\" name=\"messageID\" value=\"".$i."\"> \n";
echo "<td> \n";
if($blackListCheck) {
echo "BLACK LISTED \n";
} else {
echo "<input type=\"submit\" name=\"addBlacklist\" value=\"BLACKLIST\"> \n";
}
echo "</td> \n";
echo "<td> \n";
echo "<input type=\"text\" size=\"64\" name=\"normalReply\"> \n";
echo "<br/> \n";
echo "<center> \n";
echo "<input type=\"submit\" name=\"sendStandardReply\" value=\"SEND\"> \n";
echo "</center> \n";
echo "</td> \n";
//plugin Subscription
//echo "<td> \n";
//echo $messageQueueParts[2];
//echo "</td> \n";
echo "</tr> \n";
//echo $pluginMessages[$i];
echo "</form> \n";
}
echo "</table> \n";
//echo "</textarea> \n";
echo "<hr> \n";
echo "<center><b><h2>Profanity Messages</h2></b></center>\n";
//echo "<br/> \n";
//echo "Messages received AFTER being blacklisted and also contain profanity will NOT be in this list <br/> \n";
//echo "Those messages are checked for BlackListing First and therefore do not go to the profanity checker <br/> \n";
//echo "<br/> \n";
$profanityMessageQuery = "SELECT * FROM profanity WHERE pluginName = '".$pluginName."' ORDER BY timestamp DESC";
$profanityMessageQueryResult = $db->query($profanityMessageQuery) or die('Query failed');
//echo "<textarea class=\"FormElement\" name=\"messages\" id=\"messages\" cols=\"40\" rows=\"".$messageCount."\">\n";
echo "<table cellspacing=\"3\" cellpadding=\"3\" border=\"1\"> \n";
//check if blacklisted..
echo "<tr> \n";
echo "<td> \n";
echo "Date Received \n";
echo "</td> \n";
echo "<td> \n";
echo "Message \n";
echo "</td> \n";
echo "<td> \n";
echo "From number \n";
echo "</td> \n";
echo "<td> \n";
echo "Blacklist Status \n";
echo "</td> \n";
echo "<td> \n";
echo "Remove from Profanity File \n";
echo "</td> \n";
echo "<td> \n";
echo "<center>Send message to person</center> \n";
echo "</td> \n";
echo "</tr> \n";
while ($row = $profanityMessageQueryResult->fetchArray()) {
echo "<form name=\"messageManagementBlacklist\" method=\"post\" action=\"http://".$_SERVER['SERVER_ADDR']."/plugin.php?plugin=".$pluginName."&page=messageManagement.php\"> \n";
$blackListCheck = checkBlacklist($row['pluginData']);
if($DEBUG) {
logEntry("TWILIO MESSAGE MANAGEMENT: Returned blaklist check: ".$blackListCheck);
}
if (in_array ( $row['pluginData'], $CONTROL_NUMBER_ARRAY )) {
$TR = "yellow";
}
if (in_array ( $row['pluginData'], $WHITELIST_NUMBER_ARRAY )) {
$TR = "yellow";
}
if($blackListCheck != null) {
$TR = "red";
}
echo "<tr bgcolor=\"".$TR."\"> \n";
//unix timestamp
echo "<td> \n";
echo date('d M Y H:i:s',$row['timestamp']);
echo "<input type=\"hidden\" name=\"timestamp\" value=\"".$row['timestamp']."\"> \n";
echo "</td> \n";
echo "<td> \n";
//message data
echo urldecode($row['message']);
echo "<input type=\"hidden\" name=\"messageText\" value=\"".trim($row['message'])."\"> \n";
echo "</td> \n";
echo "<td> \n";
//message data
echo $row['pluginData'];
echo "<input type=\"hidden\" name=\"phoneNumber\" value=\"".trim($row['pluginData'])."\"> \n";
echo "</td> \n";
echo "<input type=\"hidden\" name=\"messageID\" value=\"".$i."\"> \n";
echo "<td> \n";
if($blackListCheck) {
echo "BLACK LISTED \n";
} else {
echo "<input type=\"submit\" name=\"addBlacklist\" value=\"BLACKLIST\"> \n";
}
echo "</td> \n";
echo "</td> \n";
echo "<td> \n";
echo "<input type=\"submit\" name=\"removeProfanity\" value=\"REMOVE\"> \n";
echo "</td> \n";
echo "<td> \n";
echo "<input type=\"text\" size=\"64\" name=\"profanityReply\"> \n";
echo "<input type=\"submit\" name=\"sendReply\" value=\"SEND\"> \n";
echo "</td> \n";
echo "</tr> \n";
//echo $pluginMessages[$i];
echo "</form> \n";
}
echo "</table> \n";
//echo "</textarea> \n";
$blacklistMessageQuery = "SELECT * FROM blacklist WHERE pluginName = '".$pluginName."' ORDER BY timestamp DESC";
$blackListMessageQueryResult = $db->query($blacklistMessageQuery) or die('Query failed');
echo "<hr> \n";
echo "<center><b><h2>Blacklisted Messages</h2></b></center>\n";
echo "<br/> \n";
echo "Messages will also be highlighted in RED in the ALL messages area above <br/> \n";
//echo "<textarea class=\"FormElement\" name=\"messages\" id=\"messages\" cols=\"40\" rows=\"".$messageCount."\">\n";
echo "<table cellspacing=\"3\" cellpadding=\"3\" border=\"1\"> \n";
echo "<tr> \n";
echo "<td> \n";
echo "Placed on Blacklist \n";
echo "</td> \n";
echo "<td> \n";
echo "Message \n";
echo "</td> \n";
echo "<td> \n";
echo "From number \n";
echo "</td> \n";
echo "</tr> \n";
while ($row = $blackListMessageQueryResult->fetchArray()) {
echo "<form name=\"messageManagementBlacklist\" method=\"post\" action=\"http://".$_SERVER['SERVER_ADDR']."/plugin.php?plugin=".$pluginName."&page=messageManagement.php\"> \n";
if (in_array ( $row['pluginData'], $CONTROL_NUMBER_ARRAY )) {
$TR = "yellow";
}
if (in_array ( $row['pluginData'], $WHITELIST_NUMBER_ARRAY )) {
$TR = "yellow";
}
echo "<tr bgcolor=\"".$TR."\"> \n";
//$messageQueueParts = explode("|",$pluginMessages[$i]);
//unix timestamp
echo "<td> \n";
echo date('d M Y H:i:s',$row['timestamp']);
echo "<input type=\"hidden\" name=\"timestamp\" value=\"".$row['timestamp']."\"> \n";
echo "</td> \n";
echo "<td> \n";
//message data
echo urldecode($row['message']);
echo "</td> \n";
echo "<td> \n";
//message data
echo $row['pluginData'];
echo "<input type=\"hidden\" name=\"phoneNumber\" value=\"".trim( $row['pluginData'])."\"> \n";
echo "</td> \n";
echo "<td> \n";
echo "<input type=\"submit\" name=\"delBlacklist\" value=\"Remove From Blacklist\"> \n";
echo "<input type=\"hidden\" name=\"messageID\" value=\"".$i."\"> \n";
echo "</td> \n";
//plugin Subscription
//echo "<td> \n";
//echo $messageQueueParts[2];
//echo "</td> \n";
echo "</tr> \n";
//echo $pluginMessages[$i];
echo "</form> \n";
}
echo "</table> \n";
echo "<hr/> \n";
echo "Message file management \n";
echo "<form name=\"messageManagementBlacklist\" method=\"post\" action=\"http://".$_SERVER['SERVER_ADDR']."/plugin.php?plugin=".$pluginName."&page=messageManagement.php\"> \n";
echo "<input type=\"submit\" name=\"delMessageQueue\" value=\"Delete Twilio Messages from Message Queue\"> \n";
echo "<input type=\"submit\" name=\"delProfanityQueue\" value=\"Delete Profanity Queue\"> \n";
echo "<input type=\"submit\" name=\"delBlacklistQueue\" value=\"Delete Blacklist Queue\"> \n";
echo "</form> \n";
//echo "<form name=\"MessagesPageRefresh\" method=\"get\" action=\"".$REFRESH_PAGE."\"> \n";
//echo "<input type=\"submit\" name=\"REFRESH\" value=\"REFRESH\"> \n";
//echo "Auto Refresh: \n";
//echo "<input type=\"checkbox\" name=\"AUTO_REFRESH\" value=\"".$_GET['AUTO_REFRESH']."\"> \n";
//echo "<input type=\"hidden\" name=\"REFRESH_PAGE\" value=\"".$REFRESH_PAGE."\"> \n";
//echo "</form> \n";
//echo "</form> \n";
//echo "</textarea> \n";
$db.close();
echo "</html> \n";
?>