<?php
require("../sub_inc/commfunc.php");
$DEBUG = 0;
if($DEBUG) echo "<br>ÕýÔÚµ÷ÊÔÖÐ£¡£¡";
?>
<body topmargin="0" leftmargin="12">


<?php
$pubdb = 'OMC_PUB';
$sqltable = 'OBJ_330.param_99';      
$listPageUrl = "hlr.php";                       

if($DEBUG) echo "instanceNo = $instanceNo<br>";

if($_SERVER['REQUEST_METHOD'] == "POST")
{
	if($DEBUG) echo "row = $row<br>";
	$initValue = $row;
	$initValue =setBitValue($initValue,'4.0-4.7','01');
	$k = 0;
	for($i=5; $i < 72; $i++)
	{
		if($DEBUG) echo "k = ${$k}<br>";
		$tmp = dechex(${$k});
		if($k == 1)	
		{
			$j = $i;
			$tmp = omc_keep_length($tmp,'0','2');
		}
		else 
		{
			$j = $i + 1;
			$tmp = omc_keep_length($tmp,'0','4');
		}
		$loc = $i.'.0'.'-'.$j.'.7';		
		$initValue = setBitValue($initValue,$loc,$tmp);
		if($k != 1)	$i++;
		$k++;
	}
	if($DEBUG) echo "instanceNo = $instanceNo<br>";
	if($DEBUG) echo "initValue = $initValue<br>";
	$setsql = "update $sqltable set initValue = '$initValue' 
	where level_1 = '2' and level_2 = '1' and level_3 = '14' and instanceNo = '$instanceNo'";
	if($DEBUG) echo "setsql = $setsql<br>";
	mysqli_query($pubConn,$setsql);
	echo mysqli_error($pubConn);
	
	echo "<script LANGUAGE=\"JavaScript\">";
	if(!$DEBUG){
		echo "\n window.location.href=\"$listPageUrl\";";
	} 
	echo "\n </script>";
}

$getsql = "select initValue from $sqltable
where level_1 = '2' and level_2 = '1' and level_3 = '14' and instanceNo ='$instanceNo' ";  
$result = @mysqli_query($pubConn,$getsql);
$row = @mysqli_fetch_array($result);
echo mysqli_error($pubConn);
$row = $row[0];

$k = 0;
for($i = 5;$i < 72; $i++)
{
	if($i == 7)	$j = $i;
	else $j = $i + 1;
	$loc = $i.'.0'.'-'.$j.'.7';
	$reg[$k] = hexdec(getBitValue($row,$loc));
	$k++;
	if($i != 7)	$i++;
}

echo "<form method=\"POST\" name=\"Set\" action=\"$PHP_SELF\">";
echo "<table border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"80%\">";
echo "Configuration > Network > Element > MSC > HLR";
echo "<td width=\"20%\" align=\"right\" title=\"Help\">";
showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";

echo "<table width=\"100%\">";
echo "<tr><td>";
echo "<b>Regional subscription list:&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><p align=\"right\"><a href=\"./hlr.php\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
echo "</td></tr>";
echo "</table>";

echo "<table width=\"100%\">";
echo "<tr>";
echo "<td width=\"25%\">Market ID:&nbsp;</td>";
echo "<td align==\"left\"><input type=\"text\" size = \"5\" maxlength=\"5\" value=\"$reg[0]\" class=\"text\" 
			name=\"0\" onchange = checkInput(this,10,65535)></td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"25%\" align==\"left\">Switch number:&nbsp;</td>";
echo "<td align==\"left\"><input type=\"text\" size = \"5\" maxlength=\"3\" value=\"$reg[1]\" class=\"text\" 
			name=\"1\" onchange = checkInput(this,10,255)></td>";
echo "</tr>";
echo "</table>";
?>

<TABLE  width = 100% border="1"  cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF"> 


<?php

echo "<tr bgcolor = \"#E6E6E6\">";
echo "<td width=\"25%\">Regional subscription</td>";
echo "<td width=\"25%\">Location area identity</td>";
echo "<td width=\"25%\">Regional subscription</td>";
echo "<td width=\"25%\">Location area identity</td>";
echo "</tr>";

for($i = 0;$i<16;$i++)
{
	$j = $i + 2;
	echo "<tr>";
	echo "<td>$i</td>";
	echo "<td><input type=\"text\" size = \"5\" maxlength=\"5\" value=\"$reg[$j]\" class=\"text\" 
			name=\"$j\" onchange = checkInput(this,10,65535)></td>";
	
	$j = $j + 16;
	$k = $i + 16;
	echo "<td>$k</td>";
	echo "<td><input type=\"text\" size = \"5\" maxlength=\"5\" value=\"$reg[$j]\" class=\"text\" 
			name=\"$j\" onchange = checkInput(this,10,65535)></td>";
	echo "</tr>";
};
echo "<input type=\"hidden\" name=\"instanceNo\" value=\"$instanceNo\">";
echo "<input type=\"hidden\" name=\"row\" value=\"$row\">";
echo "</table>";

?>

<?php
echo "</form>";
?>
