Files
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

222 lines
6.1 KiB
PHP
Executable File

<?php
require("../../inc/header.inc");
?>
<style type="text/css">
<!--
.style {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;background: url(--.gif); border: 0px; height: 16px;}
-->
</style>
<script language="JavaScript">
function openSet(mcc,mnc,operation)
{
URL="./operation.php?mcc="+mcc+"&mnc="+mnc+"&operation="+operation;
//var setWindow = open(URL, 'newWin', 'toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,width=400,height=350');
//setWindow.focus();
window.location.href=URL;
}
function openAd(mcc,mnc,no,operation,smsEncode)
{
URL="./operation.php?mcc="+mcc+"&mnc="+mnc+"&no="+no+"&operation="+operation+"&encode="+smsEncode;
//var setWindow = open(URL, 'newWin', 'toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,width=400,height=350');
//setWindow.focus();
window.location.href=URL;
}
</script>
<body leftmargin="15" rightmargin="10" onload="javascript:adjust();" onresize="javascript:adjust();" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<?php
function utf8_unicode($c)
{
switch(strlen($c)) {
case 1:
return ord($c);
case 2:
$n = (ord($c[0]) & 0x3f) << 6;
$n += ord($c[1]) & 0x3f;
return $n;
case 3:
$n = (ord($c[0]) & 0x1f) << 12;
$n += (ord($c[1]) & 0x3f) << 6;
$n += ord($c[2]) & 0x3f;
return $n;
case 4:
$n = (ord($c[0]) & 0x0f) << 18;
$n += (ord($c[1]) & 0x3f) << 12;
$n += (ord($c[2]) & 0x3f) << 6;
$n += ord($c[3]) & 0x3f;
return $n;
}
}
function gb2unicode($string)
{
$result="";
preg_match_all("/[\x80-\xff]?./",$string,$ar);
foreach($ar[0] as $v)
{
$temp=dechex(utf8_unicode(iconv("GB2312","UTF-8",$v)));
if(strlen($temp)==1)
$temp="0".$temp;
$result.=$temp;
}
return $result;
}
function unicode2gb($string)
{
$result="";
for($i=0;$i<strlen($string);$i++)
{
$temp.=$string[$i];
if($i!=0 && ($i+1)%4==0)
{
$result.="&#".hexdec($temp);
$temp="";
}
}
return $result;
}
?>
<?php
adjust_head();
adjust_title_head();
echo "<TABLE id=\"table_up\" border=\"0\" width=\"100%\">";
echo "<TR>";
echo "<TD width=\"50%\" align=\"left\">";
echo "$strMaintenance > Control Panel > Welcome SMS<br>";
echo "</TD>";
echo "<TD width=\"50%\" align=\"right\" title=\"Help\">";
$helpId="5.2.3";
showHelp($helpId);
echo "</TD>";
echo "</TR>";
echo "</TABLE>";
adjust_title_tail();
adjust_content_head();
echo "<br>";
?>
<?php
$DEBUG=0;
//delete one hpmn server info
if($delete==1)
{
if($DEBUG)
echo "mcc=$mcc,mnc=$mnc<br>";
//delete from the wsmsServConf
$pubDb="OMC_PUB";
$delSql = "DELETE FROM wsmsServConf WHERE mcc='$mcc' and mnc='$mnc' ";
//echo "<br>delSql=$delSql";
$delRes = @mysqli_query($pubConn,$delSql);
echo mysqli_error($pubConn);
//delete from wsmsMsgConf
$delSql = "DELETE FROM wsmsMsgConf WHERE mcc='$mcc' and mnc='$mnc' ";
//echo "<br>delSql=$delSql";
$delRes = @mysqli_query($pubConn,$delSql);
echo mysqli_error($pubConn);
echo "<font color=blue>Delete successfully!</font><br>";
}
//Get the hpmn server info from database
$database="OMC_PUB";
$selSql = "SELECT * FROM wsmsServConf ";
$selRes = @mysqli_query($pubConn,$selSql);
$HpmnCount=mysqli_num_rows($selRes);
echo mysqli_error($pubConn);
//echo "count:$HpmnCount<br>";
$HpmnIndex=0;
while($selRow = @mysqli_fetch_array($selRes))
{
$HpmnMcc[$HpmnIndex]=$selRow[mcc];
$HpmnMnc[$HpmnIndex]=$selRow[mnc];
$HpmnFlag[$HpmnIndex]=$selRow[flag];
$HpmnSmsEncode[$HpmnIndex]=$selRow[smsEncode];
$HpmnWelcomeMsg[$HpmnIndex]=$selRow[welcomeMsg];
if($HpmnSmsEncode[$HpmnIndex]==2)
$HpmnWelcomeMsg[$HpmnIndex]=unicode2gb($HpmnWelcomeMsg[$HpmnIndex]);
$HpmnIndex++;
//echo "HpmnMcc[$HpmnIndex]={$HpmnMcc[$HpmnIndex]}<br>";
}
echo "<p><table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td width=\"5%\" align=center>No.</td>";
echo "<td width=\"4%\" align=center>MCC</td>";
echo "<td width=\"4%\" align=center>MNC</td>";
echo "<td width=\"6%\" align=center>Flag</td>";
echo "<td width=\"7%\" align=center><nobr>Encode</td>";
echo "<td width=\"48%\" align=center><nobr>Welcome Message</td>";
echo "<td width=\"14%\" align=center><nobr>AD Message</td>";
echo "<td width=\"2%\" align=center>Delete</td>";
echo "</tr>";
$flagLabel=array(0=>"Disable",1=>"Enable");
$encodeSchemeLabel=array(0=>"7 bit",1=>"8 bit",2=>"16 bit");
for($i=0;$i<$HpmnCount;$i++)
{
echo "<tr>";
echo "<td align=center><a href=# onClick=\"javascript:openSet('{$HpmnMcc[$i]}','{$HpmnMnc[$i]}','edit')\">$i</a></td>";
echo "<td>{$HpmnMcc[$i]}</td>";
echo "<td>{$HpmnMnc[$i]}</td>";
echo "<td>{$flagLabel[$HpmnFlag[$i]]}</td>";
echo "<td>{$encodeSchemeLabel[$HpmnSmsEncode[$i]]}</td>";
$tmpWl=$HpmnWelcomeMsg[$i];
$maxLen=70;
if($HpmnSmsEncode[$i]==2)
$maxLen=$maxLen*3;
if(strlen($HpmnWelcomeMsg[$i])>$maxLen)
$tmpWl=substr($HpmnWelcomeMsg[$i],0,$maxLen)."...";
$cc=strlen($HpmnWelcomeMsg[$i]);
echo "<td>$tmpWl<br></td>";
//echo "<td>{$HpmnAdContent[$i]}<br></td>";
$select="SELECT * FROM wsmsMsgConf where mcc={$HpmnMcc[$i]} and mnc={$HpmnMnc[$i]} order by no ASC ";
$select_res = @mysqli_query($pubConn,$select);
echo "<td>|";
$id=1;
while($select_row= @mysqli_fetch_array($select_res))
{
$adno=$select_row[no];
$content=$select_row[content];
if($HpmnSmsEncode[$i]==2)
$content=unicode2gb($content);
echo "<a href=# title='$content' onClick=\"javascript:openAd('{$HpmnMcc[$i]}','{$HpmnMnc[$i]}','$adno','ad_edit','{$HpmnSmsEncode[$i]}')\">$id</a>|";
$id++;
}
//The max ad count is 8
if($id<=8)
echo "<a href=# onClick=\"javascript:openAd('{$HpmnMcc[$i]}','{$HpmnMnc[$i]}',-1,'ad_new','{$HpmnSmsEncode[$i]}')\">New</a><br></td>";
echo "<td><a href=\"./wsms.php?mcc={$HpmnMcc[$i]}&mnc={$HpmnMnc[$i]}&delete=1\">Delete</a></td>";
echo "</tr>";
}
echo "<tr><td><a href=# onClick=\"javascript:openSet('','','new')\">New</a></td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td>";
echo "</table>";
adjust_content_tail();
?>