<?php
require_once("../check.php");
require_once("../../core/setting.php");
$tjcode = file_get_contents("../../core/tjcode.dll");
?>
<!DOCTYPE HTML>
<html>
<head>
<title>系统设置</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="../js/jquery-1.11.1.min.js"></script>
<script>
$(function(){
    var login10 = $("#login :selected").val();
    if(login10 == "1"){
        $(".weixin").show();
    }else{
        $(".weixin").hide();
    }
    
    
    $("#login").change(function(){
        var login = $("#login").val();
        if(login=="0"){
            $(".weixin").hide();
            return false;
}       if(login=="1"){
            alert('免费版不支持微信一键登录功能');
            $(".weixin").hide();
}
    });
    
    
    $("#form").click(function(){
        var title = $("#title").val();
        var url = $("#url").val();
        var tjcode = $("#tjcode").val();
        var domain = $("#domain").val();
        var danjia = $("#danjia").val();
        var ticheng = $("#ticheng").val();
        var gotime = $("#gotime").val();
        var qiandao = $("#qiandao").val();
        var iptime = $("#iptime").val();
        var login = $("#login").val();
        var iptime = iptime*3600;
        var minpay = $("#minpay").val();
        var appid = $("#appid").val();
        var appsecret = $("#appsecret").val();
        var token = $("#token").val();
        var huidiao = $("#huidiao").val();
        if(title==false){
        alert('为了网站能正常运行,请输入网站标题!');
        return false;
        }
        
        
        $.post("../core/tjcode.php",{
            tjcode:tjcode
        },function(tja,tjb){
            
        });
        $.post("../core/system.php",{
        title:title,
        url:url,
        login:login,
        appid:appid,
        appsecret:appsecret,
        token:token,
        huidiao:huidiao,
        iptime:iptime,
        minpay:minpay,
        ticheng:ticheng,
        domain:domain,
        danjia:danjia,
        gotime:gotime,
        qiandao:qiandao
        },function(fabuok,fabuzt){
        if(fabuok=="ok"){
            alert('保存成功!');
            location.href='system.php';
            return false;
        }else{
            alert('保存出错!');
            return false;
        }
        });
        
        
        
    });
    
    
});

</script>
<body>
<style>
#forms{
    margin-top:5px;
    width:1000px;
    min-height:40px;
    max-height:120px;
    height:150px;
    display: table;
    line-height:40px;
    text-align:right;
}

#forms .form{
    margin-left:155px;
    height:35px;
    line-height:35px;
    width:150px;
    float:left;
    color: #FFFFFF;
    font-size:16px; 
    background-color:#08246B;
    border:1px solid #08246B;
    border-radius:5px;
    box-shadow:0px 0px 5px 5px #C2C2C2;   
}
#table{
    margin-top:5px;
    width:auto;
    min-height:40px;
    max-height:120px;
    height:auto;
    display: table;
    line-height:40px;
    text-align:right;
}
#table label{
    float:left;
    width:150px;
    text-align:right;
    color: #5F5F5F;
    font-size:16px;
    height:25px;
    line-height:25px;
    margin-right:5px;
}
#table input{
    border:1px solid #D8D8D8;
    border-radius:3px;
    line-height:25px;
    height:25px;
    float:left;
    color: #5F5F5F;
    font-size:14px; 
}
#table select{
    border:1px solid #D8D8D8;
    border-radius:3px;
    line-height:25px;
    height:25px;
    width:100px;
    float:left;
    color: #5F5F5F;
    font-size:14px; 
}
#table input.text{
    width:480px;  
}
#table input.xtext{
    width:100px; 
}
#table textarea{
    float:left;
    width:480px;
    height:60px;
    overflow: hidden;
    resize:none;
    border:1px solid #D8D8D8;
    border-radius:3px;
    color: #08246B;
    font-size:14px;
    color: #5F5F5F;
    
}
#table span{
    margin-left:10px;
    float:left;
    width:auto;
    height:40px;
    line-height:40px;
    font-size:12px;
    color: #08246B;
}

</style>
<?php
$login = $setting['login'];
$login0=null;
$login1=null;
if($login=="1"){
    $login1 = "selected";
}else{
    $login0 = "selected";
}

?>
<div id="table">
<label>网站名称:</label><input type="text" id="title" value="<?php echo $setting['title'];?>" class="text" />
</div>

<div id="table">
<label>Head URL:</label><input type="text" id="url" value="<?php echo $setting['url'];?>" class="text" />
</div>

<div id="table">
<label>网站域名:</label><input type="text" id="domain" value="<?php echo $setting['domain'];?>" class="text" />
</div>

<div id="table">
<label>登录方式:</label><select id="login"><option value="0" <?php echo $login0;?>>手动登录</option ><option value="0"  <?php echo $login1;?>>微信登录</option></select>
</div>

<div id="table" class="weixin">
<label>APPID:</label><input type="text" id="appid" value="<?php echo $setting['appid'];?>" class="text" />
</div>

<div id="table" class="weixin">
<label>Appsecret:</label><input type="text" id="appsecret" value="<?php echo $setting['appsecret'];?>" class="text" />
</div>

<div id="table" class="weixin">
<label>ToKen:</label><input type="text" id="token" value="<?php echo $setting['token'];?>" class="text" />
</div>

<div id="table" class="weixin">
<label>回调地址:</label><input type="text" id="huidiao" value="<?php echo $setting['huidiao'];?>" class="text" />
</div>

<div id="table">
<label>计费时间:</label><input type="text" id="gotime" value="<?php echo $setting['gotime'];?>" class="text" /><span style="font-size: 12px;color: #787878;">单位:毫秒</span></label>
</div>

<div id="table">
<label>阅读单价:</label><input type="text" id="danjia" value="<?php echo $setting['danjia'];?>" class="text" />
</div>

<div id="table">
<label>同IP计费间隔:</label><input type="text" id="iptime" value="<?php echo $setting['iptime']/3600;?>" class="text" /><span style="font-size: 12px;color: #787878;">单位:小时</span>
</div>

<div id="table">
<label>签到奖励:</label><input type="text" id="qiandao" value="<?php echo $setting['qiandao'];?>" class="text" />
</div>

<div id="table">
<label>下线提成:</label><input type="text" id="ticheng" value="<?php echo $setting['ticheng'];?>" class="text" /><span style="font-size: 12px;color: #787878;">百分比例</span>
</div>

<div id="table">
<label>最少提现:</label><input type="text" id="minpay" value="<?php echo $setting['minpay'];?>" class="text" />
</div>

<div id="table">
<label>统计代码:</label><textarea id="tjcode"><?php echo stripslashes($tjcode);?></textarea>
</div>

<div id="forms">
<input class="form" id="form" type="button" value="保存设置" />
</div>

</body>