/[projects]/smsdaemon/webinterface/sendsms.php
ViewVC logotype

Annotation of /smsdaemon/webinterface/sendsms.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 198 - (hide annotations) (download)
Thu Dec 18 19:52:25 2008 UTC (15 years, 5 months ago) by torben
File size: 947 byte(s)
Add some no-caching headers and make the html pass validation

1 torben 191 <?
2 torben 198 require("nocache.php");
3 torben 191 require("mysql.php");
4 torben 198
5 torben 191 $to = $_GET["to"];
6 torben 192 $message = str_replace("\r","",$_GET["message"]);
7 torben 191 $code = mysql_escape_string($_GET["code"]);
8     $id = intval($_GET["id"]);
9    
10     if ($to != "" && $message != "" && $code != "" && $id != "")
11     {
12 torben 197 $count = 1;
13     if (strlen($message) > 300 )
14     {
15     $message = substr($message,0,300);
16     }
17     if (strlen($message) > 160)
18     {
19     $count = 2;
20     }
21    
22    
23     $sql = "UPDATE smscount SET smscount=smscount+$count, totalcount=totalcount+$count, lastsend=now() ";
24     $sql .= "WHERE code='$code' AND id=$id AND enabled=1";
25    
26 torben 191 $count = squery($sql);
27     if ($count > 0)
28     {
29     $cmd = "smsqueue -m \"$message\" $to";
30    
31     $out = "";
32     $res = exec($cmd, $out);
33     echo $res;
34     }
35     else
36     {
37     echo "Invalid id or code, OR account is disabled!";
38     }
39     /*echo "cmd=$cmd<br>";
40     echo "res=$res<br>";
41     echo "out=$out<br>";
42     echo "id=$id<br>";
43     echo "count=$count<br>";
44     echo "sql=$sql<br>";*/
45     } else {
46     echo "Not enough parameters!";
47     }
48    
49     ?>

  ViewVC Help
Powered by ViewVC 1.1.20