Files
web.ems/wxc2_omc/element/mss/smpp_edit.php
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

591 lines
20 KiB
PHP
Executable File

<?php
require("../sub_inc/commfunc.php");
$DEBUG = 0;
if($DEBUG) echo "<br>ÕýÔÚµ÷ÊÔÖУ¡£¡";
?>
<script LANGUAGE="JavaScript">
function changeValue(term,no,page)
{
var newValue = term.value;
window.location.href='<?php echo $PHP_SELF;?>?&change_link_type='+newValue+'&instanceNo='+no+'&back_page='+page;
}
</script>
<body topmargin="0" leftmargin="12">
<?php
$helpID = "1.1.1";
$nProcFail = 0;//failure
$nWaitProc = 1;//wait
$nInProc = 2;
$nOutProc = 3;
$nGetComm = 0;
$nSetComm = 3;
$maxNum = 120;
$smpp_sysId = '260_99_99';
$smsc_sysId = '350_99_99';
$smpp_sqltable = 'OBJ_260.param_99';
$smsc_sqltable = 'OBJ_350.param_99';
$pubdb = 'OMC_PUB';
$smpp_array = array(
array('Link type', '1.0-1.7'),
array('Connection type', '2.0-2.7'),
array('Session type', '3.0-3.7'),
array('System ID', '4.0-19.7'),
array('Password', '20.0-28.7'),
array('Local GTT ', '42.0-57.7'),
array('Remote GTT', '58.0-73.7'),
array('Local IP', '74.0-77.7'),
array('Remote IP', '78.0-81.7'),
array('Session timer', '82.0-85.7'),
array('Enquire link timer', '86.0-89.7'),
array('Inactivity timer', '90.0-93.7'),
array('Response timer', '94.0-97.7'),
array('Opposite service number','98.0-105.7'),
array('flag', '0.0-0.7')
);
$smsc_array = array(
array('flag', '00.0-00.7'),
array('Session type', '01.0-01.7'),
array('Service number', '02.0-09.7'),
array('Message mode', '10.0-10.7'),
array('Data Coding Scheme', '11.0-11.7')
);
$smpp_oid = '2.1.0';
$smsc_oid = '2.2.0';
if($_SERVER['REQUEST_METHOD'] == "POST")
{
for($i=0; $i<4; $i++)
{
$tmp = "rmt_ip_$i";
$tmp = dechex(${$tmp});
$tmp = omc_keep_length($tmp,'0','2');
if($DEBUG) echo "rmt_ip_$i = $tmp<br>";
$remote_ip .= $tmp;
$tmp = "lcl_ip_$i";
$tmp = dechex(${$tmp});
$tmp = omc_keep_length($tmp,'0','2');
if($DEBUG) echo "lcl_ip_$i = $tmp<br>";
$local_ip .= $tmp;
}
if($DEBUG)
{
echo "SMPP:<br>";
echo "link_type=$link_type<br>";
echo "connect_type=$connect_type<br>";
echo "session_type=$session_type<br>";
echo "system_id=$system_id<br>";
echo "password=$password<br>";
echo "local_gtt=$local_gtt<br>";
echo "remote_gtt=$remote_gtt<br>";
echo "local_ip=$local_ip<br>";
echo "remote_ip=$remote_ip<br>";
echo "session_timer=$session_timer<br>";
echo "enquire_timer=$enquire_timer<br>";
echo "inact_timer=$inact_timer<br>";
echo "response_timer=$response_timer<br>";
echo "opposite_num=$opposite_num<br>";
}
$link_type = omc_keep_length($link_type,'0','2');
$connect_type = omc_keep_length($connect_type,'0','2');
$session_type = omc_keep_length($session_type,'0','2');
$system_id = omc_keep_length(toHex($system_id),'0','32','0');
$password = omc_keep_length(toHex($password),'0','18','0');
$local_gtt = omc_keep_length(toHex($local_gtt),'0','32','0');
$remote_gtt= omc_keep_length(toHex($remote_gtt),'0','32','0');
$local_ip = omc_keep_length($local_ip,'F','8','0');
$remote_ip = omc_keep_length($remote_ip,'F','8','0');
$session_timer= omc_keep_length(dechex($session_timer),'0','8');
$enquire_timer= omc_keep_length(dechex($enquire_timer),'0','8');
$inact_timer = omc_keep_length(dechex($inact_timer),'0','8');
$response_timer = omc_keep_length(dechex($response_timer),'0','8');
$opposite_num = omc_keep_length(toHex($opposite_num),'0','16','0');
$initValue_0 = $smpp_init;
$initValue_0 = setBitValue($initValue_0,$smpp_array[0][1],$link_type);
$initValue_0 = setBitValue($initValue_0,$smpp_array[1][1],$connect_type);
$initValue_0 = setBitValue($initValue_0,$smpp_array[2][1],$session_type);
$initValue_0 = setBitValue($initValue_0,$smpp_array[3][1],$system_id);
$initValue_0 = setBitValue($initValue_0,$smpp_array[4][1],$password);
$initValue_0 = setBitValue($initValue_0,$smpp_array[5][1],$local_gtt);
$initValue_0 = setBitValue($initValue_0,$smpp_array[6][1],$remote_gtt);
$initValue_0 = setBitValue($initValue_0,$smpp_array[7][1],$local_ip);
$initValue_0 = setBitValue($initValue_0,$smpp_array[8][1],$remote_ip);
$initValue_0 = setBitValue($initValue_0,$smpp_array[9][1],$session_timer);
$initValue_0 = setBitValue($initValue_0,$smpp_array[10][1],$enquire_timer);
$initValue_0 = setBitValue($initValue_0,$smpp_array[11][1],$inact_timer);
$initValue_0 = setBitValue($initValue_0,$smpp_array[12][1],$response_timer);
$initValue_0 = setBitValue($initValue_0,$smpp_array[13][1],$opposite_num);
$initValue_0 = setBitValue($initValue_0,$smpp_array[14][1],'01');
if($DEBUG) echo "initValue_0 = $initValue_0<br>";
$levelArr=explode('.',$smpp_oid);
for($j=0;$j<sizeof($levelArr);$j++)
{
$levelNo=$j+1;
${"level_$levelNo"}=$levelArr[$j];
//if($DEBUG) echo "<BR>levelArr[$j]={$levelArr[$j]}";
}
$setsql = "update $smpp_sqltable set initValue = '$initValue_0'
where level_1 = '$level_1' and level_2 = '$level_2' and level_3 = '$level_3' and instanceNo = '$instanceNo'";
mysqli_query($pubConn,$setsql);
echo mysqli_error($pubConn);
if($DEBUG) echo "$setsql<br>";
if($DEBUG)
{
echo "SMSC:<br>";
echo "smsc_session_type=$session_type<br>";
echo "smsc_opposite_num=$opposite_num<br>";
echo "smsc_dcs=$smsc_dcs<br>";
}
$smsc_dcs= omc_keep_length($smsc_dcs,'0','2');
$initValue_1 = $smsc_init;
$initValue_1 = setBitValue($initValue_1,$smsc_array[0][1],'01');
$initValue_1 = setBitValue($initValue_1,$smsc_array[1][1],$session_type);
$initValue_1 = setBitValue($initValue_1,$smsc_array[2][1],$opposite_num);
$initValue_1 = setBitValue($initValue_1,$smsc_array[3][1],'01');
$initValue_1 = setBitValue($initValue_1,$smsc_array[4][1],$smsc_dcs);
if($DEBUG) echo "initValue_1 = $initValue_1<br>";
$levelArr=explode('.',$smsc_oid);
for($j=0;$j<sizeof($levelArr);$j++)
{
$levelNo=$j+1;
${"level_$levelNo"}=$levelArr[$j];
//if($DEBUG) echo "<BR>levelArr[$j]={$levelArr[$j]}";
}
$setsql = "update $smsc_sqltable set initValue = '$initValue_1'
where level_1 = '$level_1' and level_2 = '$level_2' and level_3 = '$level_3' and instanceNo = '$smsc_ins'";
mysqli_query($pubConn,$setsql);
echo mysqli_error($pubConn);
if($DEBUG) echo "$setsql<br>";
if(!$DEBUG)
{
echo "<script LANGUAGE=\"JavaScript\">";
echo "\n window.location.href=\"$back_page\";";
echo "\n </script>";
}
}
if($DEBUG) echo "instanceNo=$instanceNo<br>";
if($DEBUG) echo "back_page=$back_page<br>";
if($instanceNo == 'New')
{
$levelArr=explode('.',$smpp_oid);
for($j=0;$j<sizeof($levelArr);$j++)
{
$levelNo=$j+1;
${"level_$levelNo"}=$levelArr[$j];
//if($DEBUG) echo "<BR>levelArr[$j]={$levelArr[$j]}";
}
$setsql = "select initValue from $smpp_sqltable
WHERE level_1='$level_1' AND level_2='$level_2' AND level_3='$level_3' ";
$result = mysqli_query($pubConn,$setsql);
echo mysqli_error($pubConn);
if($DEBUG) echo "<br>$setsql<br>";
$smpp_ins = 0;
while($smpp_row = mysqli_fetch_array($result))
{
$enable_flag = getBitValue($smpp_row[0],$smpp_array[14][1]);
if ($DEBUG) echo "smpp_flag = $enable_flag <br>";
if($enable_flag == 0)
break;
$smpp_ins++;
}
if($DEBUG) echo "smpp_ins = $smpp_ins<br>";
$levelArr=explode('.',$smsc_oid);
for($j=0;$j<sizeof($levelArr);$j++)
{
$levelNo=$j+1;
${"level_$levelNo"}=$levelArr[$j];
//if($DEBUG) echo "<BR>levelArr[$j]={$levelArr[$j]}";
}
$setsql = "select initValue from $smsc_sqltable
WHERE level_1='$level_1' AND level_2='$level_2' AND level_3='$level_3' ";
$result = mysqli_query($pubConn,$setsql);
echo mysqli_error($pubConn);
if($DEBUG) echo "<br>$setsql<br>";
$smsc_ins = 0;
while($smsc_row = mysqli_fetch_array($result))
{
$enable_flag = getBitValue($smsc_row[0],$smsc_array[0][1]);
if ($DEBUG)echo "smsc_flag = $enable_flag <br>";
if($enable_flag == 0)
break;
$smsc_ins++;
}
if($DEBUG) echo "smsc_ins = $smsc_ins<br>";
//clear old value
$initValue = omc_keep_length($initValue,'0','24');
$setsql = "update $smsc_sqltable set initValue = '$initValue'
where level_1 = '2' and level_2 = '2' and level_3 = '0' and instanceNo = '$smsc_ins' ";
mysqli_query($pubConn,$setsql);
echo mysqli_error($pubConn);
if($DEBUG) echo "<br>$setsql<br>";
$initValue = omc_keep_length($initValue,'0','212');
$setsql = "update $smpp_sqltable set initValue = '$initValue'
where level_1 = '2' and level_2 = '1' and level_3 = '0' and instanceNo = '$smpp_ins' ";
mysqli_query($pubConn,$setsql);
echo mysqli_error($pubConn);
if($DEBUG) echo "<br>$setsql<br>";
if($DEBUG) echo "dcs=$smsc_dcs<br>";
}
else
{
$smpp_ins = $instanceNo;
}
//==========================================================
//È¡Êý¾Ý¿âÊý¾Ý
//==========================================================
$levelArr=explode('.',$smpp_oid);
for($j=0;$j<sizeof($levelArr);$j++)
{
$levelNo=$j+1;
${"level_$levelNo"}=$levelArr[$j];
//if($DEBUG) echo "<BR>levelArr[$j]={$levelArr[$j]}";
}
$setsql = "select initValue from $smpp_sqltable
WHERE level_1='$level_1' AND level_2='$level_2' AND level_3='$level_3' AND instanceNo='$smpp_ins'";
$result = mysqli_query($pubConn,$setsql);
$smpp_row = mysqli_fetch_array($result);
echo mysqli_error($pubConn);
if($DEBUG) echo "<br>$setsql<br>";
$link_type = getBitValue($smpp_row[0],$smpp_array[0][1]);
$connect_type = getBitValue($smpp_row[0],$smpp_array[1][1]);
$session_type = getBitValue($smpp_row[0],$smpp_array[2][1]);
$system_id = toAscii(getBitValue($smpp_row[0],$smpp_array[3][1]));
$password = toAscii(getBitValue($smpp_row[0],$smpp_array[4][1]));
$local_gtt = toAscii(getBitValue($smpp_row[0],$smpp_array[5][1]));
$remote_gtt = toAscii(getBitValue($smpp_row[0],$smpp_array[6][1]));
$local_ip = getBitValue($smpp_row[0],$smpp_array[7][1]);
$remote_ip = getBitValue($smpp_row[0],$smpp_array[8][1]);
$session_timer = hexdec(getBitValue($smpp_row[0],$smpp_array[9][1]));
$enquire_timer = hexdec(getBitValue($smpp_row[0],$smpp_array[10][1]));
$inact_timer = hexdec(getBitValue($smpp_row[0],$smpp_array[11][1]));
$response_timer = hexdec(getBitValue($smpp_row[0],$smpp_array[12][1]));
$opposite_num = toAscii(getBitValue($smpp_row[0],$smpp_array[13][1]));
if($instanceNo != 'New')
{
$levelArr=explode('.',$smsc_oid);
for($j=0;$j<sizeof($levelArr);$j++)
{
$levelNo=$j+1;
${"level_$levelNo"}=$levelArr[$j];
//if($DEBUG) echo "<BR>levelArr[$j]={$levelArr[$j]}";
}
$setsql = "select initValue from $smsc_sqltable
WHERE level_1='$level_1' AND level_2='$level_2' AND level_3='$level_3' ";
$result = mysqli_query($pubConn,$setsql);
echo mysqli_error($pubConn);
if($DEBUG) echo "<br>$setsql<br>";
$smsc_ins = 0;
while($smsc_row = mysqli_fetch_array($result))
{
$smsc_session_type = getBitValue($smsc_row[0],$smsc_array[1][1]);
$smsc_opposite_num = toAscii(getBitValue($smsc_row[0],$smsc_array[2][1]));
if($smsc_session_type == $session_type && $smsc_opposite_num == $opposite_num)
{
$smsc_dcs = getBitValue($smsc_row[0],$smsc_array[4][1]);
break;
}
$smsc_ins++;
}
}
//==========================================================
//Êä³ö²¢ÏÔʾÊý¾Ý
//==========================================================
echo "<form method=\"POST\" name=\"Set\" action=\"$PHP_SELF\">";
if ($DEBUG)echo "---$smpp_ins---$smsc_ins---<br>";
echo "<input type=\"hidden\" name=\"smpp_init\" value=\"$smpp_row[0]\">";
echo "<input type=\"hidden\" name=\"smsc_init\" value=\"$smsc_row[0]\">";
echo "<input type=\"hidden\" name=\"smsc_ins\" value=\"$smsc_ins\">";
echo "<input type=\"hidden\" name=\"instanceNo\" value=\"$smpp_ins\">";
echo "<input type=\"hidden\" name=\"back_page\" value=\"$back_page\">";
?>
<?php
echo "<table border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "Configuration > Network > Element > SMSC";
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "<table width=\"100%\">";
echo "<tr><td>";
echo "<b>SMPP link:&nbsp;&nbsp;</b>";
echo "<input type=\"submit\" value=$strSave class=\"button\" name=\"Set\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
echo "<input type=\"reset\" value=$strReset class=\"button\" name=\"Reset\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
echo "</td>";
echo "<td align=\"right\"><a href=\"$back_page\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
echo "</td></tr>";
echo "</table>";
?>
<table width=100% border="1" cellpadding="1" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<?php
echo "<tr>";
echo "<td bgcolor=\"#E6E6E6\" width=50%><b>Parameters</b></td>";
echo "<td bgcolor=\"#E6E6E6\" width=50%><b>Value</b></td>";
echo "<tr>";
//==========================================================
//Êä³öLink type
//==========================================================
if($DEBUG) echo "chang_link_type = $change_link_type";
if (isset($change_link_type))
$link_type = $change_link_type;
if($DEBUG) echo "link_type = $link_type<br>";
echo "<tr >" ;
echo "<td width=\"25%\" >Link type</td>";
echo "<td><select name=\"link_type\" style=width:\"178\" onchange = changeValue(this,'$instanceNo','$back_page')>";
if ($link_type == 0)
{
echo "<option value = 0 selected>UDP";
echo "<option value = 1 >TCP";
}
else
{
echo "<option value = 1 selected>TCP";
echo "<option value = 0 >UDP";
}
echo "</td></tr>";
//==========================================================
//Êä³öConnection type
//==========================================================
echo "<tr>" ;
echo "<td>Connection type</td>";
echo "<td><select name=\"connect_type\" style=width:\"178\">";
if ($connect_type == 0)
{
echo "<option value = 0 selected>SMPP client";
echo "<option value = 1 >SMPP server";
}
else
{
echo "<option value = 1 selected>SMPP server";
echo "<option value = 0 >SMPP client";
}
echo "</td></tr>";
//==========================================================
//Êä³öSession type
//==========================================================
echo "<tr>" ;
echo "<td>Session type</td>";
echo "<td><select name=\"session_type\" style=width:\"178\">";
switch ($session_type)
{
case 0:
{
echo "<option value = 0 selected>BIND_TX";
echo "<option value = 1 >BIND_RX";
echo "<option value = 2 >BIND_TRX";
}
break;
case 1:
{
echo "<option value = 0 >BIND_TX";
echo "<option value = 1 selected>BIND_RX";
echo "<option value = 2 >BIND_TRX";
}
break;
case 2:
{
echo "<option value = 0 >BIND_TX";
echo "<option value = 1 >BIND_RX";
echo "<option value = 2 selected>BIND_TRX";
}
break;
}
echo "</td></tr>";
//==========================================================
//Êä³öSystem ID
//==========================================================
echo "<tr>";
echo "<td>System ID</td>";
echo "<td><input type = \"text\" name = \"system_id\"
value = \"$system_id\" size = \"27\" maxlength = \"16\" class=\"text\"></td>";
echo "</tr>";
//==========================================================
//Êä³öPassword
//==========================================================
echo "<tr>";
echo "<td >Password</td>";
echo "<td><input type = \"text\" name = \"password\"
value = \"$password\" size = \"27\" maxlength = \"16\" class=\"text\"></td>";
echo "</tr>";
//==========================================================
//Êä³öGT
//==========================================================
if($link_type == 0)
{
echo "<tr>";
echo "<td>Opposite GT</td>";
echo "<td><input type = \"text\" name = \"remote_gtt\"
value = \"$remote_gtt\" size = \"27\" maxlength = \"16\" class=\"text\"></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Local GT</td>";
echo "<td><input type = \"text\" name = \"local_gtt\"
value = \"$local_gtt\" size = \"27\" maxlength = \"16\" class=\"text\"></td>";
echo "</tr>";
}
//==========================================================
//Êä³öIP
//==========================================================
else
{
$rmt_ip[0] = hexdec(getBitValue($remote_ip,'0.0-0.7'));
$rmt_ip[1] = hexdec(getBitValue($remote_ip,'1.0-1.7'));
$rmt_ip[2] = hexdec(getBitValue($remote_ip,'2.0-2.7'));
$rmt_ip[3] = hexdec(getBitValue($remote_ip,'3.0-3.7'));
$lcl_ip[0] = hexdec(getBitValue($local_ip,'0.0-0.7'));
$lcl_ip[1] = hexdec(getBitValue($local_ip,'1.0-1.7'));
$lcl_ip[2] = hexdec(getBitValue($local_ip,'2.0-2.7'));
$lcl_ip[3] = hexdec(getBitValue($local_ip,'3.0-3.7'));
echo "<tr>";
echo "<td>Opposite IP</td><td>";
for($i=0; $i<4; $i++)
{
echo "<input type = \"text\" name = \"rmt_ip_$i\"
value = \"$rmt_ip[$i]\" size = \"3\" maxlength = \"3\" class=\"text\" onchange = checkInput(this,10,255)>";
if($i != 3)
echo ".";
}
echo "</td></tr>";
echo "<tr>";
echo "<td >Local IP</td><td>";
for($i=0; $i<4; $i++)
{
echo "<input type = \"text\" name = \"lcl_ip_$i\"
value = \"$lcl_ip[$i]\" size = \"3\" maxlength = \"3\" class=\"text\" onchange = checkInput(this,10,255)>";
if($i != 3)
echo ".";
}
echo "</td></tr>";
}
//==========================================================
//Êä³öOpposite service number
//==========================================================
echo "<tr>";
echo "<td >Opposite service number</td>";
echo "<td><input type = \"text\" name = \"opposite_num\" value = \"$opposite_num\"
size = \"27\" maxlength = \"8\" class=\"text\" onchange = checkInput(this,10,0)></td>";
echo "</tr>";
//==========================================================
//Êä³öDCS
//==========================================================
echo "<br>";
echo "<tr >" ;
echo "<td>Data coding scheme</td>";
echo "<td><select name=\"smsc_dcs\" style=width:\"178\">";
switch ($smsc_dcs)
{
case 0:
{
echo "<option value = 0 selected>Outgoing=7bit,Incoming=7bit";
echo "<option value = 1 >Outgoing=8bit,Incoming=7bit";
echo "<option value = 16 >Outgoing=7bit,Incoming=8bit";
echo "<option value = 17 >Outgoing=8bit,Incoming=8bit";
}
break;
case 1:
{
echo "<option value = 0 >Outgoing=7bit,Incoming=7bit";
echo "<option value = 1 selected>Outgoing=8bit,Incoming=7bit";
echo "<option value = 16 >Outgoing=7bit,Incoming=8bit";
echo "<option value = 17 >Outgoing=8bit,Incoming=8bit";
}
break;
case 16:
{
echo "<option value = 0 >Outgoing=7bit,Incoming=7bit";
echo "<option value = 1 >Outgoing=8bit,Incoming=7bit";
echo "<option value = 16 selected>Outgoing=7bit,Incoming=8bit";
echo "<option value = 17 >Outgoing=8bit,Incoming=8bit";
}
break;
case 17:
{
echo "<option value = 0 >Outgoing=7bit,Incoming=7bit";
echo "<option value = 1 >Outgoing=8bit,Incoming=7bit";
echo "<option value = 16 >Outgoing=7bit,Incoming=8bit";
echo "<option value = 17 selected>Outgoing=8bit,Incoming=8bit";
}
break;
}
echo "</tr>";
//==========================================================
//Êä³öSession timer
//==========================================================
echo "<tr>";
echo "<td >Session timer</td>";
echo "<td><input type = \"text\" name = \"session_timer\"
value = \"$session_timer\" size = \"27\" maxlength = \"16\" class=\"text\" onchange = checkInput(this,10,0)></td>";
echo "</tr>";
//==========================================================
//Êä³öEnquire link timer
//==========================================================
echo "<tr>";
echo "<td >Enquire link timer</td>";
echo "<td><input type = \"text\" name = \"enquire_timer\"
value = \"$enquire_timer\" size = \"27\" maxlength = \"16\" class=\"text\" onchange = checkInput(this,10,0)></td>";
echo "</tr>";
//==========================================================
//Êä³öInactivity timer
//==========================================================
echo "<tr>";
echo "<td >Inactivity timer</td>";
echo "<td><input type = \"text\" name = \"inact_timer\"
value = \"$inact_timer\" size = \"27\" maxlength = \"16\" class=\"text\" onchange = checkInput(this,10,0)></td>";
echo "</tr>";
//==========================================================
//Êä³öResponse timer
//==========================================================
echo "<tr>";
echo "<td >Response timer</td>";
echo "<td><input type = \"text\" name = \"response_timer\"
value = \"$response_timer\" size = \"27\" maxlength = \"16\" class=\"text\" onchange = checkInput(this,10,0)></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
?>