<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
?>
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="0"  align="center" class="tableborder">
<tr> 
<td height="23" align="left" colspan="6" class="tit1"><?=$lang['qihoo.info131'].$lang['qihoo.info133']?></td>
</tr>
<tr align="left">
<td height="23" class="forumrow" style="text-align:center;width:15%">
<input type="submit" name="Submit" value="<? echo $lang['qihoo.info132']?>" style="color: #FF0000;width:80px;height:50px;border:1px outset;">
</td>
<td height="23" class="forumrow" style="LINE-HEIGHT: 140%">
<?=$lang['qihoo.info134']?>
</td>
</tr>
</table>
<!--导航-->
<table border="0" cellspacing="0" cellpadding="0"  align="center" class="tableborder">
<tr align="center">
<td width="20%" bgcolor="White"></td>
<td width="20%" bgcolor="White"></td>
<td height="25" align="center" bgcolor="#77BEE3" width="20%"><font color="white"><?=$lang['qihoo.reg']?></font></td>
<td width="20%" bgcolor="White"></td>
<td width="20%" bgcolor="White"></td>
</tr>
</table>
<!--导航结束-->

<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="tableborder">
<form id="frmqihoo" name="frmqihoo" action="" method="POST" >
  <tr>
    <td colspan="2" class="tdtit">
  <?php
  $editstatu=$qihoo['slogo']!=''?"edit":"reg";
  ?>
    <input type="hidden" name="qihoo[open]" value="<?php echo ($qihoo["open"]^1);?>">
    <input type="hidden" size="35" name="qihoo[scharset]" id="scharset" value="gbk">
    <input type="hidden" size="35" name="qihoo[stype]" id="stype" value="">
    <input type="hidden" size="35" name="qihoo[pjt]" id="pjt" value="dvbbs_php">
    <input type="hidden" size="35" name="action" id="action" value="<?php echo $editstatu;?>">
     <input type="hidden" size="35" name="qihoo[sid]" id="sid" value="<?php echo strval($qihoo['sid'])?>">
     <input type="hidden" size="35" name="qihoo[spassword]" id="spassword" value="<?php echo strval($qihoo['spassword'])?>">
     <input type="hidden" size="35" name="qihoo[skey]" id="skey" value="<?php echo strval($qihoo['skey'])?>">
     <input type="hidden" size="35" name="qihoo[code]" id="code" value="<?php echo strval($qihoo['code'])?>">
    </td>
  </tr>
  <tr class="forumrow">
    <td width="30%" height="25"><?=$lang['qihoo.name']?></td>
    <td width="70%" height="25"><input type="text" size="35" name="qihoo[sname]" id="sname" value="<?echo $forum_info[0] ?>"  readonly=true>&nbsp;&nbsp;&nbsp;&nbsp;<a href="forum_settings.php" target="frmright">修改</a></td>
  </tr>
 
  <tr class="forumrow1">
    <td width="30%" height="25"><?=$lang['qihoo.logo']?></td>
    <td width="70%" height="25"><input type="text" size="35" name="qihoo[slogo]" id="slogo" value="<?echo $forum_info[6] ?>" readonly=true>&nbsp;&nbsp;&nbsp;&nbsp;<a href="forum_settings.php" target="frmright">修改</a></td>
  </tr>
  
  <tr class="forumrow">
    <td width="30%" height="25"><?=$lang['qihoo.url']?></td>
    <td width="70%" height="25"><input type="text" size="35" name="qihoo[surl]" id="surl" value="<?echo $forum_info[1] ?>" readonly=true>&nbsp;&nbsp;&nbsp;&nbsp;<a href="forum_settings.php" target="frmright">修改</a></td>
  </tr>
  
  <tr class="forumrow1">
    <td width="30%" height="25"><?=$lang['qihoo.email']?></td>
    <td width="70%" height="25"><input type="text" size="35" name="qihoo['semail']" id="semail" value="<?echo $forum_info[5] ?>" readonly=true>&nbsp;&nbsp;&nbsp;&nbsp;<a href="forum_settings.php" target="frmright">修改</a></td>
  </tr>
  
   
  <tr class="forumrow1">
    <td width="30%" height="25"><?=$lang['qihoo.password']?></td>
    <td width="70%" height="25"><input type="text" size="35" name="qihoo['semail']" id="semail" value="<?echo $qihoo['spassword'] ?>" readonly=true>&nbsp;&nbsp;&nbsp;&nbsp;<?=$lang['qihoo.password_1']?></td>
  </tr>
  
<tr><td colspan="2" class="forumrow1" style="text-align:center">
<input type="button" name="Submit" value="<?php echo $lang['qihoo.regenter']?>" class="button" onclick="qihoo(this)">
<?php
if($qihoo['sid']){
?>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="Submit" name="Submit" value="<?php echo ($qihoo["open"]?$lang['qihoo.close']:$lang['qihoo.open'])?>" class="button">
<?
}
?>
</td>
</tr>
</form>
</table>
<script>
btnsender=false;
objform=false;
function qihoo(sender){
	btnsender=sender;
	sender.disabled=true;
	objform=sender.form;
	action=document.getElementById('action').value;
	sscode=document.getElementById('code').value;
	ssid=document.getElementById('sid').value;
	if(action!='edit'||sscode==""||ssid==""){
		document.getElementById('action').value="reg";
		ssname=document.getElementById('sname').value;
		ssurl=document.getElementById('surl').value;
		sslogo=document.getElementById('slogo').value;
		ssemail=document.getElementById('semail').value;
		if(ssname==""){
			alert("请先在论坛基本设置中填写你的论坛名称");
			location="forum_settings.php";
			return false;
		}
		if(ssurl==""){
			alert("请先在论坛基本设置中填写你的论坛访问地址");
			location="forum_settings.php";
			return false;
		}
		if(sslogo==""){
			alert("请先在论坛基本设置中填写你的论坛首页LOGO");
			location="forum_settings.php";
			return false;
		}
		if(ssemail==""){
			alert("请先在论坛基本设置中填写你的管理员Email");
			location="forum_settings.php";
			return false;
		}
		url="http://comic.qihoo.com/dvbbs/reg.php?ofmt=json&sname="+ssname+"&surl="+ssurl+"&slogo="+sslogo+"&stype=&semail="+ssemail+"&scharset=gbk&pjt=dvbbs_php";
	}else{
		url="http://comic.qihoo.com/dvbbs/update.php?ofmt=json&sid="+ssid+"&code="+sscode;
	}

	var ojbscript = document.createElement("script");
	url+="&d="+Date();
	//url="http://comic.qihoo.com/dvbbs/reg.php?ofmt=json&sname=涵晶屋&surl=http://hjw.xuntan.com&slogo=http://hjw.xuntan.net/images/logo.gif&stype=&semail=hcc070@cndw.com&scharset=gbk&pjt=dvbbs_php";
	ojbscript.src =encodeURI(url);
	ojbscript.type = "text/javascript";
	ojbscript.language = "javascript";
	document.getElementsByTagName("head")[0].appendChild(ojbscript);

	if(document.all){
		ojbscript.onreadystatechange = function(){//IE用
			var state = ojbscript.readyState;
			if (state == "loaded" || state == "interactive" || state == "complete") {
				qihoocallback();
			}
		};
	} else {
		ojbscript.onload = function() {//FF用
			qihoocallback();
		};
	}
}

function qihoocallback(){
	if(!qihoo_json_data.retcode){
		document.getElementById('sid').value=qihoo_json_data.sid;
		document.getElementById('spassword').value=qihoo_json_data.spassword;
		document.getElementById('skey').value=qihoo_json_data.skey;
		objform.submit();
	}else{
		alert(qihoo_json_data.retmsg);
		btnsender.disabled=false;
	}
	btnsender.disabled=false;
}
</script>