# CONFIGURATION
//they can be defined or not. if not, interface will give login form
//$db_serv="127.0.0.1";
//$db_user="root";
//$db_pass="";
//these must be defined
$dokument="admin.php"; //name of current document
$delall = true; //should be Delete All available for folders ?
$max_limit=1; //maximal number of sms for outgoing sms editor
#############################
## DO NOT CHANGE BELOW !!! ##
#############################
$inbox="UpdatedInDB,ReceivingDateTime,Text,SenderNumber,Coding,UDH,SMSCNumber,Class,TextDecoded,ID,RecipientID";
$outbox="UpdatedInDB,InsertIntoDB,Text,DestinationNumber,Coding,UDH,Class,TextDecoded,ID,MultiPart,RelativeValidity,SendingDateTime,SenderID,SendingTimeOut,DeliveryReport";
$outbox_multipart="Text,Coding,UDH,Class,TextDecoded,ID,SequencePosition";
$sentitems="UpdatedInDB,InsertIntoDB,SendingDateTime,DeliveryDateTime,Text,DestinationNumber,Coding,UDH,SMSCNumber,Class,TextDecoded,ID,SenderID,SequencePosition,Status,StatusError,TPMR,RelativeValidity";
$phones="ID,InsertIntoDB,TimeOut,Send,Receive,IMEI,Client";
$daemons="Start,Info";
function dispdatetime($dt)
{
return "$dt[0]$dt[1]$dt[2]$dt[3]-$dt[5]$dt[6]-$dt[8]$dt[9] $dt[11]$dt[12]:$dt[14]$dt[15]:$dt[17]$dt[18]";
}
function dispdate($dt)
{
return "$dt[0]$dt[1]$dt[2]$dt[3]-$dt[5]$dt[6]-$dt[8]$dt[9]";
}
function dispsmsinfo($class,$udh,$text,$textdecoded,$coding)
{
if (!$udh == "") {
echo "UDH AVAILABLE
\n";
}
if ($class == "0" || $class == "1" || $class == "2" || $class == "3") {
echo "Class: $class
\n";
}
if ($coding == "8bit") {
echo "BINARY
\n";
} else {
if (!$text == "") echo "";
if ($coding == "Unicode_No_Compression" || $coding == "Unicode_Compression") {
echo "Unicode t";
} else {
echo "T";
}
if ($textdecoded == "") {
echo "ext
\n";
} else {
echo "ext: $textdecoded
\n";
}
if ($text == "") echo "";
echo "
\n";
}
}
function dispvalidity($validity) {
if ($validity == -1) {
echo "default";
} else if ($validity == 0) {
echo "5 minutes";
} else if ($validity == 255) {
echo "max. time";
} else {
echo "$validity";
}
}
$arg="";
if (!isset($db_serv) && isset($_GET['serv'])) {
$db_serv = $_GET['serv'];
if ($arg == "") {$arg="?";} else {$arg=$arg."&";};
$arg = $arg . "serv=$db_serv";
$dbservorig=false;
}
if (!isset($db_user) && isset($_GET['user'])) {
$db_user = $_GET['user'];
if ($arg == "") {$arg="?";} else {$arg=$arg."&";};
$arg = $arg . "user=$db_user";
$dbuserorig=false;
}
if (!isset($db_pass) && isset($_GET['pass'])) {
$db_pass = $_GET['pass'];
if ($arg == "") {$arg="?";} else {$arg=$arg."&";};
$arg = $arg . "pass=$db_pass";
$dbpassorig=false;
}
if ($arg == "") {$arg="?";} else {$arg=$arg."&";};
if (!isset($db_name) && isset($_GET['db'])) {
$db_name = $_GET['db'];
}
if (isset($db_pass) && isset($db_user) && isset($db_serv)) {
$dbpass = @mysql_connect("$db_serv","$db_user","$db_pass");
if ($dbpass) {
mysql_query("SET NAMES UTF8;");
if (isset($db_name)) {
$dbconnect = mysql_select_db("$db_name");
}
}
}
if (isset($dbpass) && isset($dbconnect) && isset($_GET['op']) &&
isset($_GET['year']) && isset($_GET['month']) && isset($_GET['day']) &&
isset($_GET['hour']) && isset($_GET['minute']) && isset($_GET['second']) &&
isset($_GET['number']) && isset($_GET['tresc']) && isset($_GET['validity']) &&
isset($_GET['report']) && isset($_GET['phone']))
{
if ($_GET['op']=="addsms") {
$year = $_GET['year'];
$month = $_GET['month'];
$day = $_GET['day'];
$hour = $_GET['hour'];
$minute = $_GET['minute'];
$second = $_GET['second'];
$datoom="$year$month$day$hour$minute$second";
$number=$_GET['number'];
$tresc=$_GET['tresc'];
$validity=$_GET['validity'];
if (isset($_GET['class'])) {
$class = $_GET['class'];
} else {
$class = "-1";
}
$phone = $_GET['phone'];
$report = $_GET['report'];
if (strlen($tresc) > 160) {
// $result2 = mysql_db_query("$db_name","select ID from outbox order by ID desc limit 1");
// $rekord2 = mysql_fetch_row($result2);
// if ($rekord == null) {
// $newid = 0;
// } else {
// $newid = $rekord2[0];
// }
// mysql_free_result($result2);
// $pos = 0;
// $text = "";
} else {
if ($report == "yes") {
mysql_query ("insert into outbox(UpdatedInDB,InsertIntoDB,Class,DestinationNumber,TextDecoded,SendingDateTime,RelativeValidity,SenderID,DeliveryReport,Coding) VALUES(now(),now(),'$class','$number','$tresc','$datoom','$validity','$phone','yes','Default_No_Compression')");
}
if ($report == "no") {
mysql_query ("insert into outbox(UpdatedInDB,InsertIntoDB,Class,DestinationNumber,TextDecoded,SendingDateTime,RelativeValidity,SenderID,DeliveryReport,Coding) VALUES(now(),now(),'$class','$number','$tresc','$datoom','$validity','$phone','no','Default_No_Compression')");
}
if ($report == "default") {
mysql_query ("insert into outbox(UpdatedInDB,InsertIntoDB,Class,DestinationNumber,TextDecoded,SendingDateTime,RelativeValidity,SenderID,Coding) VALUES(now(),now(),'$class','$number','$tresc','$datoom','$validity','$phone','Default_No_Compression')");
}
}
}
}
if (isset($dbpass) && isset($dbconnect) && isset($_GET['op']) && isset($_GET['dzial'])) {
if ($_GET['op']=="del") {
if (isset($_GET['id'])) {
$dzial = $_GET['dzial'];
$id = $_GET['id'];
mysql_query ("delete from $dzial where id='$id'");
if ($dzial == "outbox") {
mysql_query ("delete from outbox_multipart where id='$id'");
}
} else if ($delall) {
$dzial = $_GET['dzial'];
mysql_query ("delete from $dzial");
if ($dzial == "outbox") {
mysql_query ("delete from outbox_multipart");
}
}
}
$_GET['op']=$dzial;
}
echo "\n
\n"; echo "
\n"; exit; } if (!$dbpass) { echo "Back to login form"; } echo "