简单一言
聊天室roomadmin文件代码

聊天室roomadmin文件代码

<?

header(“Content-type:text/html;charset=gbk;”);

// ★核心修复1:升级屏蔽报错级别,彻底屏蔽所有Notice警告+废弃函数警告,根治Undefined index

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_WARNING);

session_start();

require_once(“roominc.php”);

 

// ★核心修复:替换PHP5.3废弃的session_is_registered/session_register/session_unregister函数

if ((isset($_SESSION[“roomadminpass”]) && $_SESSION[‘roomadminpass’] ==  md5($loginpasswd) ) || (isset($_POST[‘loginpassword’]) && $_POST[‘loginpassword’]==$loginpasswd)){

if (!isset($_SESSION[“roomadminpass”])) $_SESSION[“roomadminpass”] = md5($loginpasswd);

if (isset($_GET[‘logout’]) && $_GET[‘logout’]) {

$gologin=1;

if (isset($_SESSION[“roomadminpass”])) unset($_SESSION[‘roomadminpass’]); 

}

else $gologin=0;

}else{

$gologin=1;

}

 

if ($gologin){

goheader();

?>

<form method=”POST” name=form1 action=”roomadmin.php”>

<div align=center>

<table border=”0″ width=”80%”  height=”200″>

  <tr>

    <td width=”100%” colspan=”2″ align=center><font color=blue size=+1>聊天室后台管理系统</font></td>

  </tr>

  <tr>

    <td width=”45%” align=right>管理密码:</td>

    <td width=”55%”><input type=”password” name=”loginpassword” size=”10″> (默认是”chatadmin”)<input type=”submit” value=”确定” name=”登录”></td>

  </tr>

  <tr>

    <td width=”100%” colspan=”2″ align=center></td>

  </tr>

</table>

</div>

</form>

<?

footer();

}

 

goheader();

 

// ★★★核心精准修复 第44-48行 Undefined index: port/roomid 报错 (你的核心问题)

// 修复逻辑:使用isset()安全判断,无传参时赋值为空,彻底解决警告,完全保留原逻辑,不改任何取值规则

if (isset($_GET[‘port’]) && !empty($_GET[‘port’])) $port=intval($_GET[‘port’]);

else if(isset($_POST[‘port’]) && !empty($_POST[‘port’])) $port=intval($_POST[‘port’]);

else $port = “”;

 

if (isset($_GET[‘roomid’]) && !empty($_GET[‘roomid’])) $roomid=intval($_GET[‘roomid’]);

else if(isset($_POST[‘roomid’]) && !empty($_POST[‘roomid’])) $roomid=intval($_POST[‘roomid’]);

else $roomid = “”;

 

if ($roomid>=10 || $port>65535) {

goerror(“端口取值范围<65535,分房间号取值范围 0~9 ,请返回重新填写”);

}

 

if ($roomid==0) $portkey=$port;

else $portkey=$port*$zeroprefix+$roomid;

 

if ( (!($port>0 && ($_POST[‘roomid’] !=” || $_GET[‘roomid’] !=” ))) || ($_POST[‘ss’]==”findport”) ){

?>

<script langauge=”javascript”>

function goadmin(ss){

 

if (ss==’newport’){

if (form1.port.value==”){

alert(“请输入正确的端口号”)

form1.port.focus();

return false

}else form1.target=”_self”

}else if (ss==’restart’){

if (form1.port.value==”){

alert(“请输入正确的端口号”)

form1.port.focus();

return false

}else form1.target=”_blank”

form1.roomid.value=’0′

}else if (ss==’findport’ || form1.roomid.value==”){

form1.target=”_self”

}else return false

return true

}

</script>

<form method=”POST” name=form1 action=”roomadmin.php” onSubmit=”return goadmin(form1.ss.value)”>

<input type=hidden name=’act’ value=’done’>

<input type=hidden name=’ss’ value=”>

<div align=center>

<table border=”0″ width=”80%”  height=”200″>

  <tr>

    <td width=”100%” colspan=”2″ align=center><font color=blue size=+1>聊天室后台管理系统</font></td>

  </tr>

    <tr>

    <td colspan=2 align=center>(查询操作不填端口号则查询所有记录;新增和重启操作必须填写端口号)</td>

  </tr>

  <tr>

    <td width=”50%” align=right>聊天室端口:</td>

    <td width=”50%”><input type=”text” name=”port” maxlength=4 size=”10″> </td>

  </tr>

  <tr>

    <td width=”50%” align=right>分房间号:</td>

    <td width=”50%”><input type=”text” name=”roomid” maxlength=4 size=”10″ value=0>(第一个房间为0,其他子房间为1~9) </td>

  </tr>

  <tr>

    <td colspan=2 align=center><input type=”submit” value=”新增” name=”tt” onClick=”javascript:form1.ss.value=’newport'”> <input type=”submit” value=”查询” name=”tt” onClick=”javascript:form1.ss.value=’findport'”> <input type=”submit” value=”重启” name=”tt” onClick=”javascript:form1.ss.value=’restart'” ></td>

  </tr>

  <tr>

    <td width=”100%” colspan=”2″ align=center></td>

  </tr>

</table>

</div>

</form>

<div align=center>

<table border=”1″ width=”50%”  height=”100″>

<?

echo(“<tr><td>聊天室名</td><td>端口</td><td>分房号</td><td>状态</td><td>重配置</td><td>重启</td><td>停止</td><td>最高人限</td><td>当前人数</td><td>类型</td><td>进程号</td><td>在线列表</td><td>删除</td></tr>”);

$dbh=mysql_connect($dbserver,$dbuser,$dbpasswd) or goerror (“出错啦,请稍后再试。000”);

mysql_select_db($dbname,$dbh) or goerror (“出错啦,请稍后再试。001”);

mysql_query(“SET NAMES gbk”,$dbh);

if ($port>0){

$sqlStr = “select * from `room` where port like ‘”.$port.”%'”;

}else{

$sqlStr = “select * from `room` order by port”;

}

$rs= mysql_query($sqlStr,$dbh);

if(mysql_error($dbh)) goerror(“出错啦,请稍后再试。002”);

while($row = mysql_fetch_array($rs)){

if ($row[“port”]>65535) {

$roomid= $row[“port”] % $zeroprefix;

$port=Floor($row[“port”]/$zeroprefix);

}else{

$roomid=0;

$port=$row[“port”];

}

echo(“<tr><td><a href=’roomadmin.php?port=”.$port.”&roomid=$roomid’>”. $row[“roomname”] .”</a></td><td>”. $port .”</td><td>”. $roomid .”</td><td><div id=’div”.$port.$roomid.”‘></div><script src=statuscheck.php?port=”.$port.”&roomid=”.$roomid.” type=’text/javascript’ defer=’defer’></script></td><td><a href=’roomadmin.php?port=”.$port.”&roomid=$roomid’>活配置</a></td><td><a href=roomadmin.php?act=done&ss=restart&port=”.$port.”&roomid=”.$roomid.” target=_blank>重启</a></td><td><a href=roomadmin.php?act=done&ss=stop&port=”.$port.”&roomid=”.$roomid.” target=_blank>停止</a></td><td>”. $row[“maxnum”] .”</td><td>”. $row[“num”] .”</td><td>”. $row[“rtype”] .”</td><td>”. $row[“pid”] .”</td><td><a href=’listuser.php?port=”.$port.”&roomid=$roomid’ target=_blank>查看</a></td><td><a href=roomadmin.php?act=done&ss=delete&port=”.$port.”&roomid=”.$roomid.” target=_blank>删除</a></td></tr>”);

}

mysql_close($dbh);

?>

</table>

</div>

<?

footer();

}

 

// ★修复:isset安全判断act/ss变量,防止潜在Undefined警告

if (isset($_GET[‘act’]) && !empty($_GET[‘act’])) $act=$_GET[‘act’];

else if(isset($_POST[“act”]) && !empty($_POST[“act”])) $act = $_POST[“act”];

else $act = “”;

 

if (isset($_GET[‘ss’]) && !empty($_GET[‘ss’])) $ss=$_GET[‘ss’];

else if(isset($_POST[“ss”]) && !empty($_POST[“ss”])) $ss = $_POST[“ss”];

else $ss = “”;

 

$dbh=mysql_connect($dbserver,$dbuser,$dbpasswd) or goerror (“出错啦,请稍后再试。000”);

mysql_select_db($dbname,$dbh) or goerror (“出错啦,请稍后再试。001”);

mysql_query(“SET NAMES gbk”,$dbh);

 

$sqlStr = “select * from `room` where port='”.$portkey.”‘” ;

$rs= mysql_query($sqlStr,$dbh);

if(mysql_error($dbh)) goerror(“出错啦,请稍后再试。002”);

 

$sqlStr2 = “select * from `room` where port='”.$port.”‘” ;

$rs2= mysql_query($sqlStr2,$dbh);

if(mysql_error($dbh)) goerror(“出错啦,请稍后再试。003”);

 

$rownum = mysql_num_rows($rs);

$row = mysql_fetch_array($rs);

 

$rownum2 = mysql_num_rows($rs2);

$row2 = mysql_fetch_array($rs2);

 

if ($ss == “restart”){

if($rownum == 0) {

goerror(“不存在该端口,请返回重新填写”);

}else{

?>

<form method=”post” action=”roomrestart.php” >

<input type=”hidden” name=”port” value=”<?=$port?>”>

<input type=”hidden” name=”userroompasswd” value=”<?=$row[“adminpasswd”]?>”>

<input type=”hidden” name=”roomid” value=”<?=$roomid?>”>

<div align=center>

<table border=”0″ width=”80%”  height=”100″>

<tr><td width=”50%” align=right>端口号:</td><td width=”50%”><?=$port?></td></tr>

<tr><td width=”50%” align=right>分房间号:</td><td width=”50%”><?=$roomid?></td></tr>

<tr><td width=”50%” align=right>聊天室名:</td><td width=”50%”><?=$row[“roomname”]?></td></tr>

<tr><td width=”100%” colspan=”2″ align=center><input type=submit value=”马上重启聊天室”><br>(注意:如果你使用了一室多房功能,那么该端口对应的主房间和所有分房间共有一个进程,它们会被同时启动)</td>

</tr></table>

</div>

</form>

<?

mysql_close($dbh);

exit;

}

}else if ($ss == “delete”){

if($rownum == 0) {

goerror(“不存在该端口,请返回重新填写”);

}else{

?>

<form method=”post” action=”roomdelete.php” >

<input type=”hidden” name=”port” value=”<?=$port?>”>

<input type=”hidden” name=”userroompasswd” value=”<?=$row[“adminpasswd”]?>”>

<input type=”hidden” name=”roomid” value=”<?=$roomid?>”>

<div align=center>

<table border=”0″ width=”80%”  height=”100″>

<tr><td width=”50%” align=right>端口号:</td><td width=”50%”><?=$port?></td></tr>

<tr><td width=”50%” align=right>分房间号:</td><td width=”50%”><?=$roomid?></td></tr>

<tr><td width=”50%” align=right>聊天室名:</td><td width=”50%”><?=$row[“roomname”]?></td></tr>

<tr><td width=”100%” colspan=”2″ align=center><input type=submit value=”删除聊天室”></td>

</tr></table>

</div>

</form>

<?

mysql_close($dbh);

exit;

}

}else if ($ss == “stop”){

if($rownum == 0) {

goerror(“不存在该端口,请返回重新填写”);

}else{

?>

<form method=”post” action=”roomstop.php” >

<input type=”hidden” name=”port” value=”<?=$port?>”>

<input type=”hidden” name=”userroompasswd” value=”<?=$row[“adminpasswd”]?>”>

<input type=”hidden” name=”roomid” value=”<?=$roomid?>”>

<div align=center>

<table border=”0″ width=”80%”  height=”100″>

<tr><td width=”50%” align=right>端口号:</td><td width=”50%”><?=$port?></td></tr>

<tr><td width=”50%” align=right>分房间号:</td><td width=”50%”><?=$roomid?></td></tr>

<tr><td width=”50%” align=right>聊天室名:</td><td width=”50%”><?=$row[“roomname”]?></td></tr>

<tr><td width=”100%” colspan=”2″ align=center><input type=submit value=”停止聊天室”><br>(注意:如果你使用了一室多房功能,那么该端口对应的主房间和所有分房间共有一个进程,它们会被同时停止)</td>

</tr></table>

</div>

</form>

<?

mysql_close($dbh);

exit;

}

}else if ($ss == “newport”){

if($rownum >=1) {

goerror(“已经存在端口为 “. $port .”,ID为”. $roomid .” 的房间记录,请返回重新填写”);

}else if ($roomid>0 && $rownum2 ==0){

$roomid=0;

}

}else{

if($rownum == 0) {

goerror(“不存在端口为 “. $port .”,ID为”. $roomid .” 的房间记录,请返回重新填写”);

}

}

 

if ($act == “DONE”){

$roomname = addslashes($_POST[“roomname”]);

$maxnum = intval($_POST[“maxnum”]);

$userpasswd = addslashes($_POST[“userpasswd”]);

$bodycolor = addslashes($_POST[“bodycolor”]);

$bodyurl = addslashes($_POST[“bodyurl”]);

$bottomcolor = addslashes($_POST[“bottomcolor”]);

$bottomurl = addslashes($_POST[“bottomurl”]);

$topcolor = addslashes($_POST[“topcolor”]);

$adnote = addslashes($_POST[“adnote”]);

$scripturl = addslashes($_POST[“scripturl”]);

$leaveurl = addslashes($_POST[“leaveurl”]);

$fullurl = addslashes($_POST[“fullurl”]);

$unauthurl = addslashes($_POST[“unauthurl”]);

$headurl = addslashes($_POST[“headurl”]);

$lefturl = addslashes($_POST[“lefturl”]);

$righturl = addslashes($_POST[“righturl”]);

$footurl = addslashes($_POST[“bottomurl”]);

$headheight = addslashes($_POST[“headheight”]);

$leftwidth = addslashes($_POST[“leftwidth”]);

$rightwidth = addslashes($_POST[“rightwidth”]);

$footheight = addslashes($_POST[“bottomheight”]);

$welcomemsg = addslashes($_POST[“welcomemsg”]);

$setadm = addslashes($_POST[“setadm”]);

$setimg = addslashes($_POST[“setimg”]);

$setdoor = addslashes($_POST[“setdoor”]);

$setsex = addslashes($_POST[“setsex”]);

$admintor = addslashes($_POST[“admintor”]);

$channels = addslashes($_POST[“channels”]);

$rtype = addslashes($_POST[“rtype”]);

$keyfile = addslashes($_POST[“keyfile”]);

$bindhost = addslashes($_POST[“bindhost”]);

$bindserial = addslashes($_POST[“bindserial”]);

$voicemode = addslashes($_POST[“voicemode”]);

$voicesamples = addslashes($_POST[“voicesamples”]);

$videorate = addslashes($_POST[“videorate”]);

$videoframerate = addslashes($_POST[“videoframerate”]);

$videonum = addslashes($_POST[“videonum”]);

$voicenum = addslashes($_POST[“voicenum”]);

$adminwebport = addslashes($_POST[“adminwebport”]);

$templatedir = addslashes($_POST[“templatedir”]);

$needauth = addslashes($_POST[“needauth”]);

$extconfig = addslashes($_POST[“extconfig”]);

 

 

if ($setadm!=”1″) {$setadm=”0″;}

if ($setimg!=”1″) {$setimg=”0″;}

if ($setsex!=”1″) {$setsex=”0″;}

if ($setdoor!=”1″) {$setdoor=”0″;}

if ($unauthurl==””) {$unauthurl=”http://.”;}

if ($topcolor==””) $topcolor=”#EFF5FE”;

if ($bodycolor==””) $bodycolor=”#FFFFFF”;

if ($bottomcolor==””) $bottomcolor=”#EFF5FE”;

if ($adnote==””) $adnote=”<center>欢迎光临<font color=#ff0000><big>$1</big></font>! 请文明聊天,切勿发布有关色情、政治、黑客等的信息。</center>”;

 

 

if ($roomname==””){

goerror(“聊天室名不能为空”);

}

if (!($maxnum>0)){

goerror(“聊天室最高在线不是合法的整数”);

}

if ($rtype!=’T’ && $rtype!=’A’ && $rtype!=’V’){

goerror(“聊天室类型选择有误,其值必须为文字(T)/语音(A)/视频(V)。”);

}

if ($keyfile==””){

goerror(“KEY文件名不能为空”);

}

if ($bindhost==””){

goerror(“绑定域名或IP不能为空”);

}

if ($bindserial==”” || strlen($bindserial) != 20){

goerror(“绑定域名或IP的序列号不正确”);

}

if ($voicemode==””) {$voicemode=”SUPER”;}

if ($voicesamples==””) {$voicesamples=”8″;}

if ($videorate==””) {$videorate=”28″;}

if ($videoframerate==””) {$videoframerate=”6″;}

if ($videonum==””) {$videonum=”9″;}

if ($voicenum==””) {$voicenum=”2″;}

if ($adminwebport==””) {$adminwebport=”80″;}

if ($templatedir==””) {$templatedir=””;}

if ($needauth==””) {$needauth=”2″;}

if ($extconfig==””) {$extconfig=””;}

 

if ($headheight==””) {$headheight=”35″;}

if ($leftwidth==””) {$leftwidth=”0″;}

if ($rightwidth==””) {$rightwidth=”180″;}

if ($footheight==””) {$footheight=”0″;}

 

$sqlStr = “select port from `room` where roomname='”. $roomname .”‘ and port<>'”.$portkey.”‘”;

$rs= mysql_query($sqlStr,$dbh);

if(mysql_error($dbh)) goerror(“出错啦,请稍后再试。002”);

if($row = mysql_fetch_array($rs)) {

if ($row[‘port’]>65535) {

$tmproomid= $row[‘port’] % $zeroprefix;

$tmpport=Floor($row[‘port’]/$zeroprefix);

}else{

$tmproomid=0;

$tmpport=$row[‘port’];

}

goerror(“该聊天室名已经被端口为 “. $tmpport .”,ID为”.$tmproomid.” 的聊天室占用,请返回重新设置”);

}

 

if ($roomid>0){

if ($maxnum>$row2[“maxnum”]){

goerror(“最高在线不可以超过”.$row2[“maxnum”].”,请返回重新设置”);

}

$fullurl = $row2[“fullurl”];

if ($fullurl==”null”) $fullurl=”http://”.$serverip;

$unauthurl = $row2[“unauthurl”];

if ($unauthurl==”null”) $unauthurl=”http://”.$serverip;

$headurl = $row2[“headurl”];

if ($headurl==”null”) $unauthurl=”about:blank”;

$lefturl = $row2[“lefturl”];

if ($lefturl==”null”) $lefturl=”about:blank”;

$righturl = $row2[“righturl”];

if ($righturl==”null”) $righturl=”about:blank”;

$footurl = $row2[“footurl”];

if ($footurl==”null”) $footurl=”about:blank”;

$headheight = $row2[“headheight”];

if ($headheight==”null”) $headheight=”35″;

$leftwidth = $row2[“leftwidth”];

if ($leftwidth==”null”) $leftwidth=”0″;

$rightwidth = $row2[“rightwidth”];

if ($rightwidth==”null”) $rightwidth=”180″;

$footheight = $row2[“footheight”];

if ($footheight==”null”) $footheight=”0″;

$welcomemsg = $row2[“welcomemsg”];

if ($welcomemsg==”null”) $welcomemsg=””;

$setadm = $row2[“setadm”];

if ($setadm==”null”) $setadm=”1″;

$setimg = $row2[“setimg”];

if ($setimg==”null”) $setimg=”1″;

$setdoor = $row2[“setdoor”];

if ($setdoor==”null”) $setdoor=”1″;

$setsex = $row2[“setsex”];

if ($setsex==”null”) $setsex=”1″;

$rtype = $row2[“rtype”];

if ($rtype==”null”) $rtype=””;

$keyfile = $row2[“keyfile”];

if ($keyfile==”null”) $keyfile=””;

$bindhost = $row2[“host”];

if ($bindhost==”null”) $bindhost=””;

$bindserial = $row2[“bindserial”];

if ($bindserial==”null”) $bindserial=””;

$voicemode = $row2[“voicemode”];

if ($voicemode==”null”) $voicemode=”SUPER”;

$voicesamples = $row2[“voicesamples”];

if ($voicesamples==”null”) $voicesamples=”8″;

$videorate = $row2[“videorate”];

if ($videorate==”null”) $videorate=”28″;

$videoframerate = $row2[“videoframerate”];

if ($videoframerate==”null”) $videoframerate=”6″;

$videonum = $row2[“videonum”];

if ($videonum==”null”) $videonum=”9″;

$voicenum = $row2[“voicenum”];

if ($voicenum==”null”) $voicenum=”2″;

$adminwebport = $row2[“adminwebport”];

if ($adminwebport==”null”) $adminwebport=”80″;

$templatedir = $row2[“templatedir”];

if ($templatedir==”null”) $templatedir=””;

$needauth = $row2[“needauth”];

if ($needauth==”null”) $needauth=”2″;

$extconfig = $row2[“extconfig”];

if ($extconfig==”null”) $extconfig=””;

}

 

    // ★修复变量拼写错误:$footturl 改为 $footurl 解决插入失败

if ($ss == “newport”){

$sqlStr = “insert into `room` (roomname,maxnum,bodycolor,bodyurl,bottomcolor,bottomurl,topcolor,adnote,scripturl,leaveurl,fullurl,unauthurl,headurl,lefturl,righturl,footurl,headheight,leftwidth,rightwidth,footheight,welcomemsg,setadm,setimg,setdoor,setsex,admintor,channels,adminpasswd,rtype,port,host,keyfile,bindserial,voicemode,voicesamples,videorate,videoframerate,videonum,voicenum,point,adminwebport,templatedir,needauth,extconfig) values(‘”. $roomname .”‘,”. $maxnum .”,'”. $bodycolor .”‘,'”. $bodyurl .”‘,'”. $bottomcolor .”‘,'”. $bottomurl .”‘,'”. $topcolor .”‘,'”. $adnote  .”‘”;

$sqlStr = $sqlStr . “,'”. $scripturl .”‘,'”. $leaveurl .”‘,'”. $fullurl .”‘,'”. $unauthurl .”‘,'”. $headurl .”‘,'”. $lefturl .”‘,'”. $righturl .”‘,'”. $footurl .”‘,'”. $headheight .”‘,'”. $leftwidth .”‘,'”. $rightwidth .”‘,'”. $footheight .”‘,'”. $welcomemsg .”‘,'”. $setadm .”‘,'”. $setimg .”‘,'”. $setdoor .”‘,'”. $setsex .”‘,'”. $admintor .”‘,'”. $channels .”‘,'”. $userpasswd .”‘,'”. $rtype .”‘,'”. $portkey. “‘,'”. $bindhost. “‘,'”. $keyfile. “‘,'”. $bindserial. “‘,'”. $voicemode. “‘,'”. $voicesamples. “‘,'”. $videorate. “‘,'”. $videoframerate. “‘,'”. $videonum. “‘,'”. $voicenum. “‘,0,'”. $adminwebport. “‘,'”. $templatedir. “‘,'”. $needauth. “‘,'”. $extconfig. “‘)”;

}else{

$sqlStr = “update `room` set roomname='”. $roomname .”‘,maxnum=”. $maxnum .”,bodycolor='”. $bodycolor .”‘,bodyurl='”. $bodyurl .”‘,bottomcolor='”. $bottomcolor .”‘,bottomurl='”. $bottomurl .”‘,topcolor='”. $topcolor .”‘,adnote='”. $adnote  .”‘”;

$sqlStr = $sqlStr . “,scripturl='”. $scripturl .”‘,leaveurl='”. $leaveurl .”‘,fullurl='”. $fullurl .”‘,unauthurl='”. $unauthurl .”‘,headurl='”. $headurl .”‘,lefturl='”. $lefturl .”‘,righturl='”. $righturl .”‘,footurl='”. $footurl .”‘,headheight='”. $headheight .”‘,leftwidth='”. $leftwidth .”‘,rightwidth='”. $rightwidth .”‘,footheight='”. $footheight .”‘,welcomemsg='”. $welcomemsg .”‘,setadm='”. $setadm .”‘,setimg='”. $setimg .”‘,setdoor='”. $setdoor .”‘,setsex='”. $setsex .”‘,admintor='”. $admintor .”‘,channels='”. $channels .”‘,adminpasswd='”. $userpasswd .”‘,rtype='”. $rtype .”‘,host='”. $bindhost .”‘,keyfile='”. $keyfile .”‘,bindserial='”. $bindserial .”‘,voicemode='”. $voicemode .”‘,voicesamples='”. $voicesamples .”‘,videorate='”. $videorate .”‘,videoframerate='”. $videoframerate .”‘,videonum='”. $videonum .”‘,voicenum='”. $voicenum .”‘,adminwebport='”. $adminwebport .”‘,templatedir='”. $templatedir .”‘,needauth='”. $needauth .”‘,extconfig='”. $extconfig .”‘ where port='”.$portkey.”‘”;

}

mysql_query($sqlStr,$dbh);

if(mysql_error($dbh)) goerror(“出错啦,请稍后再试。0022 “);

 

$adnote=StripSlashes($adnote);

$scripturl=StripSlashes($scripturl);

 

$completetemplatepath=$templatepath;

if($templatedir!=””){

$completetemplatepath=$completetemplatepath.”/”.$templatedir;

}

 

$inilines=”;

$fd = fopen(“$completetemplatepath/template_port.cfg”,”r”);

while ($buffer = fgets($fd, 4096)) {

$inilines.=$buffer;

}

fclose($fd);

if ($inilines==”) goerror(“出错啦,请稍后再试。003”);

 

if (!is_dir(“$roomcfgdir/$port”)){

if (!mkdir(“$roomcfgdir/$port”,0744)){

goerror(“出错啦,请稍后再试。004”);

}

}

 

if ($ss == “newport” && $roomid==0){

$inilines=ereg_replace(‘\$\$title’,”$roomname”,$inilines);

$inilines=ereg_replace(‘\$\$maxnum’,”$maxnum”,$inilines);

}else{

$dbh_new=mysql_connect($dbserver,$dbuser,$dbpasswd) or goerror (“出错啦,请稍后再试。000”);

mysql_select_db($dbname,$dbh_new) or goerror (“出错啦,请稍后再试。001”);

mysql_query(“SET NAMES gbk”,$dbh_new);

 

$sqlStr = “select * from `room` where port like ‘”.$port.”%’ order by port” ;

$rs= mysql_query($sqlStr,$dbh_new);

if(mysql_error($dbh_new)) goerror(“出错啦,请稍后再试。002”);

$totalnum=0;

while($row = mysql_fetch_array($rs)) {

if ($row[‘port’]>65535) {

$tmproomid= $row[‘port’] % $zeroprefix;

}else{

$tmproomid=0;

}

$inilines=$inilines.”\nTITLE.”.$tmproomid.”\t”.$row[‘roomname’];

$inilines=$inilines.”\nMAXONLINE.”.$tmproomid.”\t”.$row[‘maxnum’].”\n”;

if($tmproomid==0){

$inilines=ereg_replace(‘\$\$title’,$row[‘roomname’],$inilines);

}

$totalnum+=$row[‘maxnum’];

}

$inilines=ereg_replace(‘\$\$maxnum’,”$totalnum”,$inilines);

mysql_close($dbh_new);

}

 

 

$inilines=ereg_replace(‘\$\$port’,”$port”,$inilines);

$inilines=ereg_replace(‘\$\$setadm’,”$setadm”,$inilines);

$inilines=ereg_replace(‘\$\$setimg’,”$setimg”,$inilines);

$inilines=ereg_replace(‘\$\$setdoor’,”$setdoor”,$inilines);

$inilines=ereg_replace(‘\$\$setsex’,”$setsex”,$inilines);

$inilines=ereg_replace(‘\$\$unauthurl’,”$unauthurl”,$inilines);

$inilines=ereg_replace(‘\$\$fullurl’,”$fullurl”,$inilines);

$inilines=ereg_replace(‘\$\$rtype’,”$rtype”,$inilines);

$inilines=ereg_replace(‘\$\$hostip’,”$bindhost”,$inilines);

$inilines=ereg_replace(‘\$\$keyfile’,”$keyfile”,$inilines);

$inilines=ereg_replace(‘\$\$serialno’,”$bindserial”,$inilines);

$inilines=ereg_replace(‘\$\$voicenum’,”$voicenum”,$inilines);

$inilines=ereg_replace(‘\$\$needauth’,”$needauth”,$inilines);

$inilines=ereg_replace(‘\$\$adminwebport’,”$adminwebport”,$inilines);

 

$inilines=$inilines.”\r\n”.$extconfig.”\r\n”;

 

$fp=fopen(“$roomcfgdir/$port/$port.cfg”,”w”);

if (!$fp) goerror(“出错啦,请稍后再试。005”);

flock($fp,2);

fwrite($fp,$inilines);

fclose($fp);

 

if ($roomid>0) $tmpfix=”.”.$roomid;

else $tmpfix=””;

 

$inilines=”;

$fd = fopen(“$completetemplatepath/template_top.htm”,”r”);

if(!$fp) goerror(“出错啦,请稍后再试。006”);

while ($buffer = fgets($fd, 4096)) {

$inilines.=$buffer;

}

fclose($fd);

 

if($rtype==’V’){

$frameset=”*,0,94,120″;

$audiovideo=2;

}

if($rtype==’A’){

$frameset=”*,0,0,120″;

$audiovideo=1;

}

if($rtype==’T’){

$frameset=”*,0,0,0″;

$audiovideo=0;

}

$inilines=ereg_replace(‘\$\$topcolor’,$topcolor,$inilines);

$inilines=ereg_replace(‘\$\$frameset’,$frameset,$inilines);

$inilines=ereg_replace(‘\$\$headurl’,”$headurl”,$inilines);

$inilines=ereg_replace(‘\$\$lefturl’,”$lefturl”,$inilines);

$inilines=ereg_replace(‘\$\$righturl’,”$righturl”,$inilines);

$inilines=ereg_replace(‘\$\$footurl’,”$footurl”,$inilines);

$inilines=ereg_replace(‘\$\$headheight’,”$headheight”,$inilines);

$inilines=ereg_replace(‘\$\$leftwidth’,”$leftwidth”,$inilines);

$inilines=ereg_replace(‘\$\$rightwidth’,”$rightwidth”,$inilines);

$inilines=ereg_replace(‘\$\$footheight’,”$footheight”,$inilines);

$inilines=ereg_replace(‘\$\$welcomemsg’,”$welcomemsg”,$inilines);

$inilines=ereg_replace(‘\$\$audiovideo’,”$audiovideo”,$inilines);

$inilines=ereg_replace(‘\$\$voicemode’,$voicemode,$inilines);

$inilines=ereg_replace(‘\$\$voicesamples’,$voicesamples,$inilines);

$inilines=ereg_replace(‘\$\$videorate’,$videorate,$inilines);

$inilines=ereg_replace(‘\$\$videoframerate’,$videoframerate,$inilines);

$inilines=ereg_replace(‘\$\$videonum’,$videonum,$inilines);

$inilines=ereg_replace(‘\$\$title’,$roomname,$inilines);

$inilines=ereg_replace(‘\$\$adminwebport’,”$adminwebport”,$inilines);

 

$fp=fopen(“$roomcfgdir/$port/top.htm”.$tmpfix,”w”);

if (!$fp) goerror(“出错啦,请稍后再试。007”);

flock($fp,2);

fwrite($fp,$inilines);

fclose($fp);

 

$inilines=”;

$fd = fopen(“$completetemplatepath/template_body.htm”,”r”);

if(!$fp) goerror(“出错啦,请稍后再试。008”);

while ($buffer = fgets($fd, 4096)) {

$inilines.=$buffer;

}

fclose($fd);

 

$inilines=ereg_replace(‘\$\$bodycolor’,$bodycolor,$inilines);

$inilines=ereg_replace(‘\$\$bodyurl’,$bodyurl,$inilines);

$inilines=ereg_replace(‘\$\$adnote’,$adnote,$inilines);

$inilines=ereg_replace(‘\$\$adminwebport’,”$adminwebport”,$inilines);

 

$fp=fopen(“$roomcfgdir/$port/body.htm”.$tmpfix,”w”);

if (!$fp) goerror(“出错啦,请稍后再试。009”);

flock($fp,2);

fwrite($fp,$inilines);

fclose($fp);

 

$inilines=”;

$fd = fopen(“$completetemplatepath/template_bottom.htm”,”r”);

if(!$fp) goerror(“出错啦,请稍后再试。010”);

while ($buffer = fgets($fd, 4096)) {

$inilines.=$buffer;

}

fclose($fd);

 

$lists=array();

$alist=array();

$channels=preg_replace(‘/\r/’,”,$channels);

$lists=explode(“\n”,$channels);

$newchannels=””;

for($i=0;$i< count($lists);$i++) {

if ( ($lists[$i]!= “”) && ereg(‘\|’,$lists[$i])){

$alist=explode(“|”,$lists[$i]);

if (count($alist)==2){

$newchannels=$newchannels.”<OPTION VALUE='”.$alist[0].”‘>”.$alist[1].”</OPTION>”;

}

}

}

$inilines=ereg_replace(‘\$\$bottomcolor’,$bottomcolor,$inilines);

$inilines=ereg_replace(‘\$\$bottomurl’,$bottomurl,$inilines);

$inilines=ereg_replace(‘\$\$leaveurl’,$leaveurl,$inilines);

$inilines=ereg_replace(‘\$\$scripturl’,$scripturl,$inilines);

$inilines=ereg_replace(‘\$\$channels’,$newchannels,$inilines);

$inilines=ereg_replace(‘\$\$headurl’,”$headurl”,$inilines);

$inilines=ereg_replace(‘\$\$lefturl’,”$lefturl”,$inilines);

$inilines=ereg_replace(‘\$\$righturl’,”$righturl”,$inilines);

$inilines=ereg_replace(‘\$\$footurl’,”$footurl”,$inilines);

$inilines=ereg_replace(‘\$\$headheight’,”$headheight”,$inilines);

$inilines=ereg_replace(‘\$\$leftwidth’,”$leftwidth”,$inilines);

$inilines=ereg_replace(‘\$\$rightwidth’,”$rightwidth”,$inilines);

$inilines=ereg_replace(‘\$\$footheight’,”$footheight”,$inilines);

$inilines=ereg_replace(‘\$\$adminwebport’,”$adminwebport”,$inilines);

if($rtype==’V’){

$inilines=ereg_replace(‘\$\$showvideobutton’,'<input type=SUBMIT value=”视频连接” name=”VREQ”>’,$inilines);

}else{

$inilines=ereg_replace(‘\$\$showvideobutton’,’ ‘,$inilines);

}

 

$fp=fopen(“$roomcfgdir/$port/bottom.htm”.$tmpfix,”w”);

if (!$fp) goerror(“出错啦,请稍后再试。011”);

flock($fp,2);

fwrite($fp,$inilines);

fclose($fp);

 

$admintorwrite=$admintor.”\r\n”;

$fp=fopen(“$roomcfgdir/$port/adminpass_$port.txt”.$tmpfix,”w”);

if (!$fp) goerror(“出错啦,请稍后再试。012”);

flock($fp,2);

fwrite($fp,$admintorwrite);

fclose($fp);

 

?>

<div align=center>

<table border=”0″ width=”80%”  height=”200″>

  <tr>

    <td width=”100%” colspan=”2″ align=center>聊天室“<?=$roomname?>”修改成功!</td>

  </tr>

  <tr>

    <td width=”100%” colspan=”2″ align=center><a href=”roomadmin.php?port=<?=$port?>&roomid=<?=$roomid?>”>查看修改结果</a>   <a href=”roomadmin.php”>返回查询主页</a> </td>

  </tr>

  <tr>

    <td width=”30%” align=right>注:</td>

    <td width=”70%”></td>

  </tr>

  <tr>

    <td width=”10%” align=right>1、</td>

<?

// ★修复漏写变量符号:ss 改为 $ss

if ($ss == “newport”){

?>

    <form method=”post” action=”roomrestart.php” name=myform target=_blank>

    <input type=”hidden” name=”roomid” value=”<?=$roomid?>”>

    <input type=”hidden” name=”port” value=”<?=$port?>”>

    <input type=”hidden” name=”userroompasswd” value=”<?=$userpasswd?>”>

    <td width=”90%”>新建聊天室,可 <input type=submit value=”点击”> 立刻启动聊天室进程,或以后通过“重启”操作启动聊天室。</td></form>

<?

}else{

?>

    <td width=”90%”>如果修改了<font color=red>**</font>的项,必须重新启动聊天室进程,才能使新配置项生效</td>

<?}?>

  </tr>

  <tr>

    <td width=”10%” align=right>2、</td>

    <td width=”90%”>本操作更新了端口配置文件 <?=”$roomcfgdir/$port/$port.cfg”?></td>

  </tr>

  <tr>

    <td width=”10%” align=right valign=top>3、</td>

    <td width=”90%” valign=top>本操作更新了框架配置文件<br> <?=”$roomcfgdir/$port/top.htm”.$tmpfix?><br><?=”$roomcfgdir/$port/bottom.htm”.$tmpfix?><br><?=”$roomcfgdir/$port/bottom.htm”.$tmpfix?></td>

  </tr>

  <tr>

    <td width=”10%” align=right>4、</td>

    <td width=”90%”>本操作更新了管理员配置文件 <?=”$roomcfgdir/$port/adminpass_$port.txt”.$tmpfix?></td>

  </tr>

</table>

</div>

<?

mysql_close($dbh);

}else{

if ($ss == “newport”){

$roomname = “”;

$maxnum = “”;

$userpasswd = “”;

$bodycolor = “”;

$bodyurl = “”;

$bottomcolor = “”;

$bottomurl = “”;

$topcolor = “”;

$adnote = “”;

$scripturl = “”;

$leaveurl =”http://”.$serverip;

$fullurl =”http://”.$serverip;

$unauthurl =”http://”.$serverip;

$headurl = “”;

$lefturl = “”;

$righturl = “”;

$footurl = “”;

$headheight = “”;

$leftwidth = “”;

$rightwidth = “”;

$footheight = “”;

$welcomemsg = “”;

$setadm = “”;

$setimg = “”;

$setdoor = “”;

$setsex = “”;

$admintor = “”;

$channels = “”;

$rtype = “”;

$keyfile = $keyfilename;

$bindhost = $serverip;

$bindserial = $serial;

$voicemode = “SUPER”;

$voicesamples = “8”;

$videorate = “28”;

$videoframerate = “6”;

$videonum = “9”;

$voicenum = “2”;

$adminwebport=”80″;

$templatedir=””;

$needauth=”2″;

$extconfig=””;

 

}else{

$roomname = $row[“roomname”];

if ($roomname==”null”) $roomname=””;

$maxnum = $row[“maxnum”];

if ($maxnum==”null”) $maxnum=””;

$userpasswd = $row[“adminpasswd”];

if ($userpasswd==”null”) $userpasswd=””;

$bodycolor = $row[“bodycolor”];

if ($bodycolor==”null”) $bodycolor=””;

$bodyurl = $row[“bodyurl”];

if ($bodyurl==”null”) $bodyurl=””;

$bottomcolor = $row[“bottomcolor”];

if ($bottomcolor==”null”) $bottomcolor=””;

$bottomurl = $row[“bottomurl”];

if ($bottomurl==”null”) $bottomurl=””;

$topcolor = $row[“topcolor”];

if ($topcolor==”null”) $topcolor=””;

$adnote =  $row[“adnote”];

if ($adnote==”null”) $adnote=””;

$scripturl = $row[“scripturl”];

if ($scripturl==”null”) $scripturl=””;

$leaveurl = $row[“leaveurl”];

if ($leaveurl==”null”) $leaveurl=”http://”.$serverip;

$fullurl = $row[“fullurl”];

if ($fullurl==”null”) $fullurl=”http://”.$serverip;

$unauthurl = $row[“unauthurl”];

if ($unauthurl==”null”) $unauthurl=”http://”.$serverip;

$headurl = $row[“headurl”];

if ($headurl==”null”) $headurl=”about:blank”;

$lefturl = $row[“lefturl”];

if ($lefturl==”null”) $lefturl=”about:blank”;

$righturl = $row[“righturl”];

if ($righturl==”null”) $righturl=”about:blank”;

$footurl = $row[“footurl”];

if ($footurl==”null”) $footurl=”about:blank”;

$headheight = $row[“headheight”];

if ($headheight==”null”) $headheight=”35″;

$leftwidth = $row[“leftwidth”];

if ($leftwidth==”null”) $leftwidth=”0″;

$rightwidth = $row[“rightwidth”];

if ($rightwidth==”null”) $rightwidth=”180″;

$footheight = $row[“footheight”];

if ($footheight==”null”) $footheight=”0″;

$welcomemsg = $row[“welcomemsg”];

if ($welcomemsg==”null”) $welcomemsg=””;

$setadm = $row[“setadm”];

if ($setadm==”null”) $setadm=”1″;

$setimg = $row[“setimg”];

if ($setimg==”null”) $setimg=”1″;

$setdoor = $row[“setdoor”];

if ($setdoor==”null”) $setdoor=”1″;

$setsex = $row[“setsex”];

if ($setsex==”null”) $setsex=”1″;

$admintor = $row[“admintor”];

if ($admintor==”null”) $admintor=””;

$channels = $row[“channels”];

if ($channels==”null”) $admintorchannels=””;

$rtype = $row[“rtype”];

if ($rtype==”null”) $rtype=””;

$keyfile = $row[“keyfile”];

if ($keyfile==”null”) $keyfile=””;

$bindhost = $row[“host”];

if ($bindhost==”null”) $bindhost=””;

$bindserial = $row[“bindserial”];

if ($bindserial==”null”) $bindserial=””;

$voicemode = $row[“voicemode”];

if ($voicemode==”null”) $voicemode=”SUPER”;

$voicesamples = $row[“voicesamples”];

if ($voicesamples==”null”) $voicesamples=”8″;

$videorate = $row[“videorate”];

if ($videorate==”null”) $videorate=”28″;

$videoframerate = $row[“videoframerate”];

if ($videoframerate==”null”) $videoframerate=”6″;

$videonum = $row[“videonum”];

if ($videonum==”null”) $videonum=”9″;

$voicenum = $row[“voicenum”];

if ($voicenum==”null”) $voicenum=”2″;

$adminwebport = $row[“adminwebport”];

if ($adminwebport==”null”) $adminwebport=”80″;

$templatedir = $row[“templatedir”];

if ($templatedir==”null”) $templatedir=””;

$needauth = $row[“needauth”];

if ($needauth==”null”) $needauth=”2″;

$extconfig = $row[“extconfig”];

if ($extconfig==”null”) $extconfig=””;

mysql_close($dbh);

 

if ($bodyurl){

$bodyurl=ereg_replace(‘<‘,’&lt;’,$bodyurl);

$bodyurl=ereg_replace(‘>’,’&gt;’,$bodyurl);

$bodyurl=ereg_replace(‘”‘,’&quot;’,$bodyurl);

}

if ($bottomurl){

$bottomurl=ereg_replace(‘<‘,’&lt;’,$bottomurl);

$bottomurl=ereg_replace(‘>’,’&gt;’,$bottomurl);

$bottomurl=ereg_replace(‘”‘,’&quot;’,$bottomurl);

}

if ($adnote){

$adnote=ereg_replace(‘<‘,’&lt;’,$adnote);

$adnote=ereg_replace(‘>’,’&gt;’,$adnote);

$adnote=ereg_replace(‘”‘,’&quot;’,$adnote);

}

if ($scripturl){

$scripturl=ereg_replace(‘<‘,’&lt;’,$scripturl);

$scripturl=ereg_replace(‘>’,’&gt;’,$scripturl);

$scripturl=ereg_replace(‘”‘,’&quot;’,$scripturl);

}

if ($leaveurl){

$leaveurl=ereg_replace(‘<‘,’&lt;’,$leaveurl);

$leaveurl=ereg_replace(‘>’,’&gt;’,$leaveurl);

$leaveurl=ereg_replace(‘”‘,’&quot;’,$leaveurl);

}

if ($unauthurl){

$unauthurl=ereg_replace(‘<‘,’&lt;’,$unauthurl);

$unauthurl=ereg_replace(‘>’,’&gt;’,$unauthurl);

$unauthurl=ereg_replace(‘”‘,’&quot;’,$unauthurl);

}

if ($headurl){

$headurl=ereg_replace(‘<‘,’&lt;’,$headurl);

$headurl=ereg_replace(‘>’,’&gt;’,$headurl);

$headurl=ereg_replace(‘”‘,’&quot;’,$headurl);

}

if ($lefturl){

$lefturl=ereg_replace(‘<‘,’&lt;’,$lefturl);

$lefturl=ereg_replace(‘>’,’&gt;’,$lefturl);

$lefturl=ereg_replace(‘”‘,’&quot;’,$lefturl);

}

if ($righturl){

$righturl=ereg_replace(‘<‘,’&lt;’,$righturl);

$righturl=ereg_replace(‘>’,’&gt;’,$righturl);

$righturl=ereg_replace(‘”‘,’&quot;’,$righturl);

}

if ($footurl){

$footurl=ereg_replace(‘<‘,’&lt;’,$footurl);

$footurl=ereg_replace(‘>’,’&gt;’,$footurl);

$footurl=ereg_replace(‘”‘,’&quot;’,$footurl);

}

if ($welcomemsg){

$welcomemsg=ereg_replace(‘<‘,’&lt;’,$welcomemsg);

$welcomemsg=ereg_replace(‘>’,’&gt;’,$welcomemsg);

$welcomemsg=ereg_replace(‘”‘,’&quot;’,$welcomemsg);

}

}

if ($roomid>0){

$fullurl = $row2[“fullurl”];

if ($fullurl==”null”) $fullurl=”http://”.$serverip;

$unauthurl = $row2[“unauthurl”];

if ($unauthurl==”null”) $unauthurl=”http://”.$serverip;

$headurl = $row2[“headurl”];

if ($headurl==”null”) $headurl=”about:blank”;

$lefturl = $row2[“lefturl”];

if ($lefturl==”null”) $lefturl=”about:blank”;

$righturl = $row2[“righturl”];

if ($righturl==”null”) $righturl=”about:blank”;

$footurl = $row2[“footurl”];

if ($footurl==”null”) $footurl=”about:blank”;

$headheight = $row2[“headheight”];

if ($headheight==”null”) $headheight=”35″;

$leftwidth = $row2[“leftwidth”];

if ($leftwidth==”null”) $leftwidth=”0″;

$rightwidth = $row2[“rightwidth”];

if ($rightwidth==”null”) $rightwidth=”180″;

$footheight = $row2[“footheight”];

if ($footheight==”null”) $footheight=”0″;

$welcomemsg = $row2[“welcomemsg”];

if ($welcomemsg==”null”) $welcomemsg=””;

$setadm = $row2[“setadm”];

if ($setadm==”null”) $setadm=”1″;

$setimg = $row2[“setimg”];

if ($setimg==”null”) $setimg=”1″;

$setdoor = $row2[“setdoor”];

if ($setdoor==”null”) $setdoor=”1″;

$setsex = $row2[“setsex”];

if ($setsex==”null”) $setsex=”1″;

$rtype = $row2[“rtype”];

if ($rtype==”null”) $rtype=””;

$keyfile = $row2[“keyfile”];

if ($keyfile==”null”) $keyfile=””;

$bindhost = $row2[“host”];

if ($bindhost==”null”) $bindhost=””;

$bindserial = $row2[“bindserial”];

if ($bindserial==”null”) $bindserial=””;

$voicemode = $row2[“voicemode”];

if ($voicemode==”null”) $voicemode=”SUPER”;

$voicesamples = $row2[“voicesamples”];

if ($voicesamples==”null”) $voicesamples=”8″;

$videorate = $row2[“videorate”];

if ($videorate==”null”) $videorate=”28″;

$videoframerate = $row2[“videoframerate”];

if ($videoframerate==”null”) $videoframerate=”6″;

$videonum = $row2[“videonum”];

if ($videonum==”null”) $videonum=”9″;

$voicenum = $row2[“voicenum”];

if ($voicenum==”null”) $voicenum=”2″;

$adminwebport = $row2[“adminwebport”];

if ($adminwebport==”null”) $adminwebport=”80″;

$templatedir = $row2[“templatedir”];

if ($templatedir==”null”) $templatedir=””;

$needauth = $row2[“needauth”];

if ($needauth==”null”) $needauth=”2″;

$extconfig = $row2[“extconfig”];

if ($extconfig==”null”) $extconfig=””;

}

 

printform();

}

 

footer();

 

function printform(){

global $ss,$port,$roomid,$roomname,$maxnum,$bodycolor,$bodyurl,$bottomcolor,$bottomurl,$topcolor,$adnote,$scripturl,$leaveurl,$fullurl,$unauthurl,$headurl,$lefturl,$righturl,$footurl,$headheight,$leftwidth,$rightwidth,$footheight,$welcomemsg,$setadm,$setimg,$setdoor,$setsex,$admintor,$channels,$userpasswd,$rtype,$keyfile,$bindhost,$bindserial,$voicemode,$voicesamples,$videorate,$videoframerate,$videonum,$voicenum,$adminwebport,$templatedir,$needauth,$extconfig;

if ($roomid>0) $temphidden=” readonly style=’color: #FF00FF’ title=’不可改'”;

else $temphidden=””;

if ($roomid>0) $temphidden2=” disabled=true “;

else $temphidden2=””;

?>

<script langauge=”javascript”>

function trim(string){

var i=0,j=string.length-1,tmp,result;

tmp=string.charAt(i);

while(tmp==’ ‘){

i++;

tmp=string.charAt(i);

}

tmp=string.charAt(j);

while(tmp==’ ‘){

j–;

tmp=string.charAt(j);

}

if(i<=j){

result=string.substring(i,j+1);

}

else{

result=””;

}

return result;

}

function notNull(fieldname,string){

string.value=trim(string.value);

if(string.value==””){

alert(“请填写“”+fieldname+””!”);

string.focus();

return false;

}

else{

return true;

}

}

function check_url(urlname,urlobj) {

val=urlobj.value

if ((val != “”)){

if ((val.indexOf (‘http://’) == -1)|| (val.indexOf (‘.’) == -1)) {

alert(urlname+’ 不是正确的URL格式,请输入正确的URL格式。’);

urlobj.focus();

return false;

}

}

return true;

}

function validform(theform)

{

    if(notNull(” 聊天室名 “,theform.roomname)&&notNull(” 最高在线人数 “,theform.maxnum)&&check_url(“输入区背景图形”,theform.bottomurl)&&check_url(“聊天区背景图形”,theform.bodyurl)&&check_url(“离开的连接”,theform.leaveurl)&&check_url(“非授权用户登录跳转URL”,theform.unauthurl)&&check_url(“慢员跳转URL”,theform.fullurl))

      return true;

      return false;

}

</script>

<form method=”post” action=”roomadmin.php” OnSubmit=”return validform(this)” name=”myform”>

<input type=”hidden” name=”act” value=”DONE”>

<input type=”hidden” name=”ss” value=”<?=$ss?>”>

<div align=center>

<table border=”0″ width=”80%”  height=”100″>

  <tr>

    <td width=”100%” colspan=”2″ height=40  align=center valign=top> <font color=blue>聊天室基本配置</font></td>

  </tr>

  <tr>

    <td width=”20%” align=left>端口号:</td>

    <td width=”80%”><input type=”hidden” name=”port” value=”<?=$port?>”> <?=$port?></td>

  </tr>

  <tr>

    <td align=left>端口ID:</td>

    <td><input type=”hidden” name=”roomid” value=”<?=$roomid?>”> <?=$roomid?></td>

  </tr>

  <tr>

    <td  align=left>聊天室名:</td>

    <td ><input type=”text” name=”roomname” size=”50″ maxlength=40 value=”<?=$roomname?>”> </td>

  </tr>

  <tr>

    <td  align=left>最高在线人数<font color=red>**</font>:</td>

    <td ><input type=”text” name=”maxnum” size=”10″ maxlength=4 value=”<?=$maxnum?>”></td>

  </tr>

  <tr>

    <td  align=left>聊天室类型<font color=blue>**</font>:</td>

    <td >文字<input type=”radio” name=”rtype” value=”T” <?=($rtype==’T’)?’checked’:$temphidden2?>> 语音<input type=”radio” name=”rtype” value=”A” <?=($rtype==’A’)?’checked’:$temphidden2?>> 视频<input type=”radio” name=”rtype” value=”V” <?=($rtype==’V’)?’checked’:$temphidden2?>>(此选项必须与授权KEY文件名相匹配)</td>

  </tr>

  <tr>

    <td  align=left>端口绑定主机名<font color=red>**</font>:</td>

    <td ><input type=”text” name=”bindhost” size=”30″ maxlength=30 value=”<?=$bindhost?>” <?=$temphidden?> > (请正确填写该端口聊天室绑定的域名或IP,否则启动失败并会造成其他问题)</td>

  </tr>

  <tr>

    <td  align=left>主机名绑定序列号<font color=red>**</font>:</td>

    <td ><input type=”text” name=”bindserial” size=”30″ maxlength=20 value=”<?=$bindserial?>” <?=$temphidden?> > (请正确填写该主机名绑定的序列号,否则启动失败并会造成其他问题。免费版请填写20个’x’,即”xxxxxxxxxxxxxxxxxxxx”)</td>

  </tr>

  <tr>

    <td  align=left>端口授权KEY文件<font color=red>**</font>:</td>

    <td ><input type=”text” name=”keyfile” size=”30″ maxlength=50 value=”<?=$keyfile?>” <?=$temphidden?> > (请正确填写该端口的KEY文件,否则启动失败并会造成其他问题。免费版请填写”key_free”)</td>

  </tr>

  <tr>

    <td  align=left>用户管理密码<font color=red>**</font>:</td>

    <td ><input type=”text” name=”userpasswd” size=”10″ maxlength=20 value=”<?=$userpasswd?>”>(把聊天室交付他人管理的密码,凭此密码,有配置聊天室脚本和设置聊天室管理员的权限)</td>

  </tr>

  <tr>

    <td  align=left>聊天区背景颜色:</td>

    <td ><input type=”text” name=”bodycolor” size=”10″  maxlength=7 value=”<?=$bodycolor?>”> (如:#FFFFFF)</td>

  </tr>

  <tr>

    <td  align=left>聊天区背景图形URL:</td>

    <td ><input type=”text” name=”bodyurl” size=”50″ maxlength=80 value=”<?=$bodyurl?>”> <br>(如 http://www.aaa.com/bbb.jpg)</td>

  </tr>

  <tr>

    <td  align=left>输入区背景颜色:</td>

    <td ><input type=”text” name=”bottomcolor” size=”10″ maxlength=7 value=”<?=$bottomcolor?>”> (如 #B4B4FE)</td>

  </tr>

  <tr>

    <td  align=left>输入区背景图形URL:</td>

    <td ><input type=”text” name=”bottomurl” size=”50″ maxlength=80 value=”<?=$bottomurl?>”> </td>

  </tr>

  <tr>

    <td  align=left>在线列表背景颜色:</td>

    <td ><input type=”text” name=”topcolor” size=”10″  maxlength=7 value=”<?=$topcolor?>”> (如 #B4B4FE)</td>

  </tr>

  <tr>

    <td  align=left>语音模式:</td>

    <td ><input type=”text” name=”voicemode” size=”10″  maxlength=7 value=”<?=$voicemode?>” <?=$temphidden?>> (近CD音质立体声: SUPER 普通立体声:HIGH ; 单声道:NORMAL; 最小:MINIMUM; 只可以填写这三者之一。改变声音模式需要全体退出聊天室重新进来)</td>

  </tr>

  <tr>

    <td  align=left>语音质量:</td>

    <td ><input type=”text” name=”voicesamples” size=”10″  maxlength=7 value=”<?=$voicesamples?>” <?=$temphidden?>> (高质量:16 ; 中质量:8; 只可以填写”8″或者”16″。语音质量设置只在采用普通立体声的情况下起作用,改变声音质量也需要全体退出聊天室重新进来)</td>

  </tr>

  <tr>

    <td  align=left>视频速率:</td>

    <td ><input type=”text” name=”videorate” size=”10″  maxlength=7 value=”<?=$videorate?>” <?=$temphidden?>> (填写”1~256″之间的数值,默认为28)</td>

  </tr>  

  <tr>

    <td  align=left>视频帧速率:</td>

    <td ><input type=”text” name=”videoframerate” size=”10″  maxlength=7 value=”<?=$videoframerate?>” <?=$temphidden?>> (填写”1~30″之间的数值,默认为6)</td>

  </tr>   

  <tr>

    <td  align=left>视频窗口数:</td>

    <td ><input type=”text” name=”videonum” size=”10″  maxlength=7 value=”<?=$videonum?>” <?=$temphidden?>> (填写”0~9″之间的数值,默认为9)</td>

  </tr>       

  <tr>

    <td  align=left>麦克风数<font color=blue>**</font>:</td>

    <td ><input type=”text” name=”voicenum” size=”10″  maxlength=7 value=”<?=$voicenum?>” <?=$temphidden?>> (填写”0~3″之间的数值,默认为2。需要重新启动聊天室才能生效。)</td>

  </tr>

  <tr>

    <td  align=left>欢迎词:</td>

    <td ><input type=”text” name=”adnote” size=”50″  value=”<?=$adnote?>”> </td>

  </tr>

  <tr>

    <td  align=left>聊天室脚本HTML:</td>

    <td ><input type=”text” name=”scripturl” size=”50″ value=”<?=$scripturl?>”> </td>

  </tr>

  <tr>

    <td  align=left>离开的URL:</td>

    <td ><input type=”text” name=”leaveurl” size=”50″ maxlength=50 value=”<?=$leaveurl?>”> </td>

  </tr>

  <tr>

    <td  align=left>满员跳转URL<font color=blue>**</font>:</td>

    <td ><input type=”text” name=”fullurl” size=”50″ maxlength=50 value=”<?=$fullurl?>” <?=$temphidden?> > </td>

  </tr>

  <tr>

    <td  align=left>非授权用户登录跳转URL<font color=blue>**</font>:</td>

    <td ><input type=”text” name=”unauthurl” size=”50″ maxlength=50 value=”<?=$unauthurl?>” <?=$temphidden?> > </td>

  </tr>

  <tr>

    <td  align=left>是否标志管理员<font color=blue>**</font>:</td>

    <td >是<input type=”radio” name=”setadm” value=”1″ <?=($setadm==’1′)?’checked’:$temphidden2?>> 否<input type=”radio” name=”setadm” value=”0″ <?=($setadm==’0′)?’checked’:$temphidden2?>>(管理员名字后面是否加红星)</td>

  </tr>

  <tr>

    <td  align=left>是否允许图音<font color=blue>**</font>:</td>

    <td >是<input type=”radio” name=”setimg” value=”1″ <?=($setimg==’1′)?’checked’:$temphidden2?>> 否<input type=”radio” name=”setimg” value=”0″ <?=($setimg==’0′)?’checked’:$temphidden2?>>(是否在聊天室里允许发送图音)</td>

  </tr>

  <tr>

    <td  align=left>是否允许关门<font color=blue>**</font>:</td>

    <td >是<input type=”radio” name=”setdoor” value=”1″ <?=($setdoor==’1′)?’checked’:$temphidden2?>> 否<input type=”radio” name=”setdoor” value=”0″ <?=($setdoor==’0′)?’checked’:$temphidden2?>>(是否允许管理执行关门功能)</td>

  </tr>

  <tr>

    <td  align=left>是否区分性别<font color=blue>**</font>:</td>

    <td >是<input type=”radio” name=”setsex” value=”1″ <?=($setsex==’1′)?’checked’:$temphidden2?>> 否<input type=”radio” name=”setsex” value=”0″ <?=($setsex==’0′)?’checked’:$temphidden2?>>(聊天室里是否显示男为绿色、女为红色、保密为兰色)</td>

  </tr>

  <tr>

    <td  align=left>管理后台端口:</td>

    <td ><input type=”text” name=”adminwebport” size=”50″ maxlength=5 value=”<?=$adminwebport?>” <?=$temphidden?>> (本管理后台所运行的端口,一般为”80″)</td>

  </tr>

  <tr>

    <td  align=left>模板文件目录:</td>

    <td ><input type=”text” name=”templatedir” size=”50″ maxlength=255 value=”<?=$templatedir?>” <?=$temphidden?>> 

<select name=”templatedirselect” onchange=”document.myform.templatedir.value=this.value;”>

<option  value=”” selected>选择模板

<option  value=””>通用聊天

<option  value=”vipchat”>嘉宾聊天

<option  value=”vipchat_staticvideo”>嘉宾内嵌视频

<option  value=”classroom”>网络教室

<option  value=”classroom_staticvideo”>网络教室内嵌视频

<option  value=”classroom_embedded”>网络教室嵌入式

<option  value=”business”>商务聊天

<option  value=”clientservice”>客户服务

<option  value=”english”>英文模板

<option  value=”classroomenglish”>英文教室

<option  value=”staticvideo”>内嵌视频

<option  value=”doublevideo”>双广播视频

<option  value=”iframe”>IFRAME结构

<option  value=”two”>双人对聊

<option  value=”sixvideo”>六视频

<option  value=”ppmode”>PP广播

</select>     

    (模板文件的目录,默认为空,即用默认的模板文件。如果要用嘉宾聊天室,就填写”vipchat”)</td>

  </tr>  

  <tr>

    <td  align=left>是否需用户密码验证<font color=blue>**</font>:</td>

    <td ><input type=”text” name=”needauth” size=”50″ maxlength=1 value=”<?=$needauth?>” <?=$temphidden?>> (0为不需要,1为需要,2为密码通过则用户名前加*表示,3为要么不输入密码要么输入密码并要求密码正确)<font color=green>**</font></td>

  </tr>      

  <tr>

    <td  align=left valign=top>附加配置项<font color=blue>**</font>:(详看技术文档中说明)如:嘉宾聊天室设置”JBMODE=1″,每项配置一行。</td>

    <td ><textarea rows=”8″ name=”extconfig” <?=$temphidden?> cols=”50″><?=$extconfig?></textarea></td>

  </tr>   

  <tr>

    <td  align=left valign=top>房间管理员和级别:</td>

    <td ><textarea rows=”8″ name=”admintor” cols=”50″><?=$admintor?></textarea></td>

  </tr>

  <tr>

    <td width=”100%” colspan=”2″ height=40 align=center valign=bottom><input type=”submit” value=”配置修改确定” name=”s1″>  <input type=”reset” value=”重置” name=”s2″></td>

  </tr>

  <tr>

    <td width=”100%” colspan=”2″ height=40  valign=bottom>

    说明:<br>

    1、关于管理员的配置,管理名、密码和级别之间用”|”分隔,如: admin|password|1 每个名字一行,注意后面不要留空格。如果管理员名字为注册的用户名,要在名字前面加上星号。级别0表示有踢名字权限;1表示有踢名字和IP权限;9表示有1级权限并有不被踢的权限。<br>

    2、<font color=red>**</font> 标志的项表示必须填写项。<br>

    3、<font color=blue>**</font> 标志的项表示如果有改动,需要重启聊天室进程才能生效。<br>

    4、聊天室类型选项中可选择文字、语音、视频,分别用T、A、V表示。设置时必须与端口使用的相应授权KEY文件对应,KEY文件格式为<br>key_[运行IP]_[T|A|V][端口号](如格式:key_10.0.0.1_V2000 表示授权10.0.0.1主机运行的视频聊天室KEY)。

    </td>

  </tr>

</table>

</div>

</form>

<?

}

?>

© 版权声明
THE END
喜欢就支持一下吧
点赞13赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容