<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/inc/mysql.inc");
//require_once ($_SERVER['DOCUMENT_ROOT']."/inc/pgsql.inc");

$pnum = isset($_POST['pnum']) ? $_POST['pnum'] : $_GET['pnum'];
$pmsg = isset($_POST['pmsg']) ? $_POST['pmsg'] : $_GET['pmsg'];

$ifp = fopen("./log/siliver_sms.log", "a+");

$pmsg = urldecode($pmsg);
fwrite($ifp, $pnum."\r\n");
fwrite($ifp, $pmsg."\r\n");

// parsing mobile phone
$phone_list = split('\|', $pnum);

$dbConnMySql = new dbconnect('211.39.134.240', 'sms', '', 'sms', __FILE__, __LINE__);

foreach ($phone_list as $each_phone)
{
	if (trim($each_phone) == "")
		continue;
	$cli_ip = $_SERVER['REMOTE_ADDR'];
	$tmpSqlmy  = "INSERT INTO sms_msg (phone, callback, reqdate, msg,etc1 )  ";
	$tmpSqlmy .= "VALUES ( '$each_phone', '', sysdate(), '$pmsg', '$cli_ip')";
	fwrite($ifp, $tmpSqlmy."\r\n");

	$dbConnMySql->query($tmpSqlmy,__FILE__, __LINE__);
}

fclose($ifp);
$dbConnMySql->close();
?>
