300 lines
10 KiB
PHP
Executable File
300 lines
10 KiB
PHP
Executable File
<?php
|
||
/*********************************************************
|
||
程序说明:
|
||
功能说明:设置七号信令中的 Network code
|
||
|
||
调用关系:调用: header.inc
|
||
被调用:
|
||
|
||
变量说明:
|
||
|
||
作者:
|
||
|
||
修改注释:
|
||
NO.1
|
||
姓名: Cui Ticun
|
||
时间:2004-4-21
|
||
修改说明:Support OMC7.0,从advanced移到configuration中,修改
|
||
和添加了上方的操作按钮
|
||
*********************************************************/
|
||
require("../../inc/header.inc");
|
||
$helpId = "2.1.0";
|
||
$DEBUG = 0;
|
||
|
||
if($DEBUG) echo "<br>正在调试中!!";
|
||
//==========================================================
|
||
//变量定义
|
||
//==========================================================
|
||
$nGetComm = 0;
|
||
$nSetComm = 3;
|
||
$maxNum = 30;
|
||
|
||
$pubDb = 'OMC_PUB';
|
||
$paramTable ='OBJ_225.param_99';
|
||
$sysId ='225_99_99';
|
||
$instanceNo ='0';
|
||
$initValue ='initValue';
|
||
$editValue ='editValue';
|
||
$readValue ='readValue';
|
||
|
||
$nProcFail = 0;//failure
|
||
$nWaitProc = 1;//wait
|
||
$nInProc = 2;
|
||
$nOutProc = 3;
|
||
|
||
$NetworkCodeArr=array(
|
||
//array('oid', 'inputName', 'showName','inputLen'),
|
||
array('2.1', 'MCC' ,'Mobile country code (MCC)' ,'4'),
|
||
array('2.2', 'MNC' ,'Mobile network code (MNC)' ,'4'),
|
||
array('2.3', 'CC' ,'Country code (CC)' ,'4'),
|
||
array('2.4', 'NDC' ,'National destination code (NDC)' ,'6'),
|
||
array('2.5', 'IP' ,'International prefix' ,'4'),
|
||
array('2.6', 'NP' ,'National prefix' ,'4')
|
||
);
|
||
|
||
|
||
//==========================================================
|
||
//输入变量
|
||
//==========================================================
|
||
if($DEBUG) echo "<BR>sysId =$sysId";
|
||
if($DEBUG) echo "<BR>instanceNo =$instanceNo";
|
||
if($DEBUG) echo "<BR>objIdStr =$objIdStr";
|
||
|
||
//==========================================================
|
||
//数据处理
|
||
//==========================================================
|
||
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
||
//发送命令
|
||
if(isset($setSys) || isset($getSys)){
|
||
if(isset($setSys)){
|
||
for($i=0;$i<sizeof($NetworkCodeArr);$i++){
|
||
$unitObjIdStr=$NetworkCodeArr[$i][0];
|
||
$unitInputName=$NetworkCodeArr[$i][1];
|
||
$unitValue=getSysParamValue($sysId,$unitObjIdStr,$instanceNo,$initValue);
|
||
$unitLen=$NetworkCodeArr[$i][3];
|
||
$unitSetValue = ${$unitInputName};
|
||
for($j=strlen($unitSetValue);$j<$unitLen;$j++){
|
||
$unitSetValue .='E';
|
||
}
|
||
setSysParamValue($sysId,$unitObjIdStr,$instanceNo,$unitSetValue);
|
||
if($DEBUG) echo "<BR>setSysParamValue($sysId,$unitObjIdStr,$instanceNo,$unitSetValue)";
|
||
}
|
||
|
||
$commIdStr = sysCommSend($sysId,$nSetComm,$objIdStr);
|
||
$showType="Set";
|
||
}else{
|
||
$commIdStr = sysCommSend($sysId,$nGetComm,$objIdStr);
|
||
$showType="Get";
|
||
}
|
||
$i = 0;
|
||
while(1)
|
||
{
|
||
//echo "<br>i=$i";
|
||
if($i == 0)
|
||
echo "<br>$showType network code";
|
||
if($i > $maxNum){
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">Timeout</font>";
|
||
break;
|
||
}
|
||
echo "<img border=\"0\" src=\"../../images/arrow.gif\" width=\"10\" height=\"10\">";
|
||
flush();
|
||
$sysId = "225_99_99";
|
||
$chkType = "0";
|
||
$chRes=ChComm($sysId,$chkType);
|
||
//echo "<br>chRes=$chRes";
|
||
if($chRes == $nOutProc || $chRes == $nProcFail){
|
||
if($chRes == $nProcFail)
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
elseif($remark == 'response timeout')
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
else
|
||
echo "<br><font size=\"2\" color=\"#0000FF\">$remark</font><br>";
|
||
break;
|
||
}
|
||
|
||
sleep(1);
|
||
$i++;
|
||
}
|
||
$moveSql = "UPDATE $paramTable SET initValue = readValue
|
||
WHERE level_1='2'
|
||
";
|
||
if($DEBUG) echo "<BR>moveSql=$moveSql";
|
||
mysqli_query($pubConn,$moveSql);
|
||
echo mysqli_error($pubConn);
|
||
}elseif(isset($saveSys)){
|
||
$updSql = " UPDATE $paramTable SET initValue = '01'
|
||
WHERE level_1 = '3' AND level_2 = '2'
|
||
";
|
||
$updRes = @mysqli_query($pubConn,$updSql);
|
||
echo mysqli_error($pubConn);
|
||
$commIdStr=sysCommSend($sysId,$nSetComm,'3.2');
|
||
if($DEBUG) echo "<BR>commIdStr =$commIdStr";
|
||
if($DEBUG) echo "<BR>commIdStr =$commIdStr";
|
||
$i = 0;
|
||
while(1)
|
||
{
|
||
//echo "<br>i=$i";
|
||
if($i == 0)
|
||
echo "<br>Save parameter to system";
|
||
if($i > $maxNum){
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">Timeout</font>";
|
||
break;
|
||
}
|
||
echo "<img border=\"0\" src=\"../../images/arrow.gif\" width=\"10\" height=\"10\">";
|
||
flush();
|
||
$sysId = "225_99_99";
|
||
$chkType = "0";
|
||
$chRes=ChComm($sysId,$chkType);
|
||
//echo "<br>chRes=$chRes";
|
||
if($chRes == $nOutProc || $chRes == $nProcFail){
|
||
if($chRes == $nProcFail)
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
elseif($remark == 'response timeout')
|
||
echo "<br><font size=\"2\" color=\"#FF0000\">$remark</font><br>";
|
||
else
|
||
echo "<br><font size=\"2\" color=\"#0000FF\">$remark</font><br>";
|
||
break;
|
||
}
|
||
|
||
sleep(1);
|
||
$i++;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
if($setSys || $getSys || $saveSys || $undoSet||$resetSys){
|
||
echo "<br>";
|
||
echo "<p align=\"left\"><a href=\"$PHP_SELF?setFlag=$setFlag\" target=\"contents\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
|
||
exit();
|
||
}
|
||
//==========================================================
|
||
//输出并显示数据
|
||
//==========================================================
|
||
if($DEBUG) echo "<BR>";
|
||
?>
|
||
|
||
<?php
|
||
function ChComm($sysId,$chkType)
|
||
{
|
||
global $omc_db;
|
||
global $remark,$nProcFail,$nWaitProc,$nInProc,$nOutProc;
|
||
|
||
$commTable = "parameterComm";
|
||
|
||
$sysIdArr = explode('_',$sysId);
|
||
$sysTypeNo = $sysIdArr[0];
|
||
$sysNo = $sysIdArr[1];
|
||
$subSysNo = $sysIdArr[2];
|
||
|
||
if($chkType==0)
|
||
$selComm = " SELECT commState,remark FROM $commTable WHERE sysTypeNo = '$sysTypeNo' ";
|
||
else
|
||
$selComm = " SELECT commState,remark FROM $commTable WHERE sysTypeNo = '$sysTypeNo' AND sysNo = '$sysNo' ";
|
||
|
||
$selRes = @mysqli_query($pubConn,$selComm);
|
||
$selRow = @mysqli_fetch_array($selRes);
|
||
echo mysqli_error($pubConn);
|
||
$outProcCount=0;
|
||
do
|
||
{
|
||
$temCommState = $selRow[commState];
|
||
if(isset($selRow[remark])){
|
||
$remark = $selRow[remark];
|
||
if($DEBUG)echo "<br>remark=$remark";
|
||
}
|
||
if($DEBUG)echo "<br>temCommState=$temCommState";
|
||
if($temCommState == $nWaitProc){
|
||
return($nWaitProc);
|
||
}elseif($temCommState == $nInProc){
|
||
return($nInProc);
|
||
}elseif($temCommState == $nOutProc){
|
||
$commState = $nOutProc;
|
||
$outProcCount++;
|
||
}else{
|
||
$commState = $nProcFail;
|
||
}
|
||
}while($selRow = @mysqli_fetch_array($selRes));
|
||
if($outProcCount > 0){
|
||
return($nOutProc);
|
||
}else{
|
||
return($nProcFail);
|
||
}
|
||
}
|
||
?>
|
||
|
||
<body topmargin="0" leftmargin="12">
|
||
<?php
|
||
echo "<form method=\"POST\" name=\"setForm\" action=\"$PHP_SELF\">";
|
||
echo "<table border=\"0\" width=\"100%\">";
|
||
echo "<tr>";
|
||
echo "<td width=\"50%\">";
|
||
echo "$strConfiguration > $strNetwork > SS7 > $strNetworkCode";
|
||
echo "</td>";
|
||
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
|
||
showHelp($helpId);
|
||
echo "</td>";
|
||
echo "</tr>";
|
||
echo "</table>";
|
||
echo "<BR>";
|
||
/*
|
||
echo "<b>System:</b> ";
|
||
echo "<input type=\"submit\" name=\"getSys\" value=\"$strGet\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
echo "<input type=\"submit\" name=\"setSys\" value=\"$strSet\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
echo "<input type=\"submit\" name=\"saveSys\" value=\"$strSave\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
if ( TRUE == session_is_registered("networkSetFlag") ) {
|
||
echo "<input type=\"submit\" name=\"undoSet\" value=\"$strUndo\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
}else{
|
||
echo "<input type=\"submit\" name=\"undoSet\" value=\"$strUndo\" DISABLED class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
}
|
||
echo "<b>OMC:</b> ";
|
||
echo "<input type=\"submit\" name=\"getOmc\" value=\"$strGet\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
echo "<input type=\"submit\" name=\"saveOmc\" value=\"$strSave\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
echo "<input type=\"hidden\" name=\"objIdStr\" value=\"2\">";
|
||
echo "<BR><BR>";
|
||
*/
|
||
echo "<b>System:</b> ";
|
||
echo "<input type=\"submit\" name=\"getSys\" value=\"$strGet\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
echo "<input type=\"submit\" name=\"setSys\" value=\"$strSet\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
/*
|
||
if ( TRUE == session_is_registered("networkSetFlag") ) {
|
||
echo "<input type=\"submit\" name=\"undoSet\" value=\"$strUndo\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
}else{
|
||
echo "<input type=\"submit\" name=\"undoSet\" value=\"$strUndo\" DISABLED class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\"> ";
|
||
}
|
||
*/
|
||
echo " ";
|
||
echo "<b>Command:</b> ";
|
||
echo "<input type=\"submit\" name=\"saveSys\" value=\"$strSave\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
//echo "<input type=\"submit\" name=\"resetSys\" value=\"$strReset\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
|
||
echo "<input type=\"hidden\" name=\"objIdStr\" value=\"2\">";
|
||
echo "<BR><BR>";
|
||
|
||
$tableHeader ="<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" ";
|
||
$tableHeader .="bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\">";
|
||
|
||
echo "\n $tableHeader";
|
||
echo "\n <tr bgcolor=\"#E6E6E6\">";
|
||
echo "<td>Name</td><td>Value</td>";
|
||
echo "</tr>";
|
||
|
||
for($i=0;$i<sizeof($NetworkCodeArr);$i++){
|
||
$unitObjIdStr=$NetworkCodeArr[$i][0];
|
||
$unitValue=getSysParamValue($sysId,$unitObjIdStr,$instanceNo,$initValue);
|
||
$unitLen=$NetworkCodeArr[$i][3];
|
||
$unitValue=str_replace('E','',$unitValue);
|
||
$unitInputName=$NetworkCodeArr[$i][1];
|
||
$unitShowName=$NetworkCodeArr[$i][2];
|
||
echo "\n <tr>";
|
||
echo "<td>$unitShowName</td>";
|
||
echo "<td><input type=text name=\"$unitInputName\" maxlength=\"$unitLen\" value=\"$unitValue\" class=\"text\"></td>";
|
||
echo "</tr>";
|
||
}
|
||
|
||
echo "\n </table>";
|
||
?>
|
||
</form>
|
||
|
||
</body>
|
||
</html>
|