|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /var/www/html/pathumthani_integration/requirement/application/ecomplain/ |
Upload File : |
<?
###################################################################
## SMS FUNCTION
###################################################################
## Version : 20091019.001 (Created/Modified; Date.RunNumber)
## Created Date : 2009-10-?? hh:mm
## Created By : Mr.PUDIS PROMSRI (PAAK)
## E-mail : pudis@sapphire.co.th
## Tel. : 086-1860538
## Company : Sappire Research and Development Co.,Ltd. (C)All Right Reserved
###################################################################
##
## Version :
## Modified Detail:
## Modified Date :
## Modified By :
##
###################################################################
## SMS FUNCTION
$sms_mode='on'; // เปิดระบบการส่ง sms ในโหมดที่มีการตั้งค่าอัตโนมัติ
$sms_mode_manual='on'; // เปิดระบบการส่ง sms ในโหมดที่มีการตั้งค่าเลือกส่งเอง
function sendRequest($host,$method,$path,$data){
//$method = strtoupper($method);
$fp = fsockopen($host, 80);
fputs($fp, "$method $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp,"Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($data) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST'){
fputs($fp, $data);
}
while (!feof($fp)){
$result .= fgets($fp,128);
}
fclose($fp);
return $result;
}
function gwStatus($raw_socket_return) {
$raw_socket_return = trim($raw_socket_return);
$socket_status = "";
$socket_return = explode("\n", $raw_socket_return);
$count = count($socket_return);
$iresult = $count-1;
$socket_status = $socket_return[$iresult];
return $socket_status;
}
### END SMS FUNCTION
$sms_status=gwStatus($result_sms);
function SendSMS2db($sms_Msn,$sms_Msg) {
global $sms_host,$sms_method,$sms_path,$sms_RefNo,$sms_Sender,$sms_MsgType,$sms_User,$sms_Password,$dbname,$sms_mode,$sms_mode_manual;
$appid="5"; // ร้องทุกข์
### SMS config
$dbname= "pathumthani_warningsystem";
$sms_host="www.sms.in.th";
$sms_method="POST";
$sms_path="/tunnel/sendsms.php";
$sms_RefNo="1001";//1001-9999
$sms_MsgType="T";
$sms_Sender="Eoffice";
$sms_User="sapphire";
$sms_Password="es53y7h";
$sms_defualt_mobile="086676915";
### SMS config
$Msg=$sms_Msg;
$Msn=$sms_Msn;
$host=$sms_host;
$method=$sms_method;
$path=$sms_path;
$RefNo=$sms_RefNo;
$Sender=$sms_Sender;
$MsgType=$sms_MsgType;
$User=$sms_User;
$Password=$sms_Password;
$result_sms = sendRequest($host,$method,$path,'RefNo='.$RefNo.'&Sender='.$Sender.'&Msn='.$Msn.'&Msg='.$Msg.'&MsgType='.$MsgType.'&User='.$User.'&Password='.$Password);
$sms_status=gwStatus($result_sms);
$sql_sms_log="
INSERT INTO `tbl_sms_log` SET
`sms_refno`='$RefNo',
`sms_from`='$Sender',
`sms_to`='$Msn',
`sms_status`='$sms_status',
`sms_type`='$MsgType',
`sms_text`='$Msg',
`sms_application`='$appid'
";
//echo "<pre>".$sql_sms_log." ".$dbname;
$result_sms_log = @mysql_query($sql_sms_log);
}
?>