<?php
# Name: PHP版程氏音乐CMS管理系统 v3.0
# Author: 程氏<web@chshcms.com> [QQ:848769359]
# Homepage:http://www.chshcms.cn/
include_once("../../lib/cs_config_qq.php");
include_once("../../lib/cs_conn.php");
include_once("../../lib/cs_common.php");
include_once("../loginstate.php");
SystemPer('1_3');
?>
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>csdjcms management</title>
<link href="../res/css/admin_style.css" rel="stylesheet" />
<script type="text/javascript" src="../res/js/ajax.js"></script>
<script language="javascript" src="../res/js/jquery.js"></script>
</head>
<body>
<div class="wrap">
<form method="post" class="J_ajaxForm" action="?a=edit">
<div class="h_a">QQ登入基本配置</div>
<div class="table_full">
	<table width="100%">
		<col class="th" />
		<col width="400" />
		<col />
		<tr>
			<th>QQ登入开关</th>
			<td>
				<ul class="switch_list cc">
					<li><label><input name="CS_QQFun" type="radio" value="0" <?php if(CS_QQFun==0){echo("checked='checked'");}?>><span>开启</span></label></li>
					<li><label><input name="CS_QQFun" type="radio" value="1" <?php if(CS_QQFun==1){echo("checked='checked'");}?>><span>关闭</span></label></li>
				</ul>
			</td>
			<td><div class="fun_tips">QQ登入开关设置</div>--><a href="http://connect.qq.com/intro/login/" target="_blank">申请地址</a></td>
		</tr>
		<tr>
			<th>appid</th>
			<td>
				<div class="mb10"><input name="CS_appid" type="text" class="input length_5" value="<?php echo CS_appid?>"></div>
			</td>
			<td><div class="fun_tips">＊appid，如：210000</div></td>
		</tr>
		<tr>
			<th>appkey</th>
			<td>
				<div class="mb10"><input name="CS_appkey" type="text" class="input length_5" value="<?php echo CS_appkey?>"></div>
			</td>
			<td><div class="fun_tips">＊appkey(32位)，如：a5e946c646fb8cc6d7fdb6f306000000</div></td>
		</tr>
	</table>
</div>
<div class="btn_wrap">
	<div class="btn_wrap_pd">
		<button class="btn btn_submit mr10 J_ajax_submit_btn" type="submit">提交保存</button>
                <div class="tips_error" id="Msg"></div>
	</div>
</div></form>
<!-- end -->
</div>
<?php
$action=CS_Request("a");
if ($action=="edit"){
	$CS_QQFun=CS_Request("CS_QQFun");
	$CS_appid=CS_Request("CS_appid");
	$CS_appkey=CS_Request("CS_appkey");
	$CS_MUrl="http://".$_SERVER['HTTP_HOST']."/user/open/qq/qq_callback.php";

	$strs="<?php"."\r\n";
	$strs=$strs."define(\"CS_QQFun\",".$CS_QQFun.");      //登入开关\r\n";
	$strs=$strs."define(\"CS_appid\",\"".$CS_appid."\");      //appid\r\n";
	$strs=$strs."define(\"CS_appkey\",\"".$CS_appkey."\");      //appkey\r\n";
	$strs=$strs."define(\"CS_callback\",\"".$CS_MUrl."\");      //返回地址";

	//写文件
	$ifile = new iFile('../../lib/cs_config_qq.php','w');
	if(!$ifile->WriteFile($strs,3)) exit("<script>document.getElementById('Msg').innerHTML='../../lib/cs_config_qq.php没有修改权限!';</script>");
         echo '<script>document.getElementById("Msg").className="tips_success";$("#Msg").text("恭喜,操作成功!").css("color","#026E12");</script>';
	 echo "<script>setTimeout(\"window.location='config_qq.php'\",2000);</script>";
}
?>
</body>
</html>
