<?php
/**
 * 系统设置
**/
include("../php/common.php");
$title='后台管理';
include './head.php';
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
?>
  <nav class="navbar navbar-fixed-top navbar-default">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
          <span class="sr-only">导航按钮</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="./">后台管理</a>
      </div><!-- /.navbar-header -->
      <div id="navbar" class="collapse navbar-collapse">
        <ul class="nav navbar-nav navbar-right">
          <li>
            <a href="./"><span class="glyphicon glyphicon-user"></span> 平台首页</a>
          </li>
		  <li>
            <a href="./list.php"><span class="glyphicon glyphicon-list"></span> 代点列表</a>
          </li>
		  <li>
            <a href="./bllist.php"><span class="glyphicon glyphicon-calendar"></span> 补领列表</a>
          </li>
		  <li>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-cloud"></span> 卡密管理<b class="caret"></b></a>
            <ul class="dropdown-menu">
              <li><a href="./kmlist.php">卡密列表</a></li>
			  <li><a href="./search.php">搜索卡密</a><li>
            </ul>
          </li>
		  <li class="active"><a href="./set.php"><span class="glyphicon glyphicon-cog"></span> 系统设置</a></li>
          <li><a href="./login.php?logout"><span class="glyphicon glyphicon-log-out"></span> 退出登陆</a></li>
        </ul>
      </div><!-- /.navbar-collapse -->
    </div><!-- /.container -->
  </nav><!-- /.navbar -->
  <div class="container" style="padding-top:70px;">
    <div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
<?php
if(isset($_POST['submit'])) {
	foreach ($_POST as $k => $value) {
		if($k=='pwd')continue;
		$value=daddslashes($value);
		$DB->query("insert into qiu_config set `k`='{$k}',`v`='{$value}' on duplicate key update `v`='{$value}'");
	}
	$pwd=daddslashes($_POST['pwd']);
	if(!empty($pwd))$DB->query("update `qiu_config` set `v` ='{$pwd}' where `k`='admin_pwd'");
	showmsg('修改成功！',1);
}else{
?>
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title">系统配置</h3></div>
<div class="panel-body">
  <form action="./set.php" method="post" class="form-horizontal" role="form">
	<div class="form-group">
	  <label class="col-sm-2 control-label">网站名称</label>
	  <div class="col-sm-10"><input type="text" name="title" value="<?php echo $conf['title']; ?>" class="form-control" required/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">关键字</label>
	  <div class="col-sm-10"><input type="text" name="keywords" value="<?php echo $conf['keywords']; ?>" class="form-control" required/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">网站描述</label>
	  <div class="col-sm-10"><input type="text" name="description" value="<?php echo $conf['description']; ?>" class="form-control"/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">全局底部</label>
	  <div class="col-sm-10"><textarea class="form-control" name="footer" rows="2"><?php echo htmlspecialchars($conf['footer']); ?></textarea></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">首页广告</label>
	  <div class="col-sm-10"><textarea class="form-control" name="guanggao" rows="3"><?php echo htmlspecialchars($conf['guanggao']); ?></textarea></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">站长ＱＱ</label>
	  <div class="col-sm-10"><input type="text" name="zzqq" value="<?php echo $conf['zzqq']; ?>" class="form-control"/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">代点月卡地址</label>
	  <div class="col-sm-10"><input type="text" name="kmurl1" value="<?php echo $conf['kmurl1']; ?>" class="form-control"/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">代点年卡地址</label>
	  <div class="col-sm-10"><input type="text" name="kmurl2" value="<?php echo $conf['kmurl2']; ?>" class="form-control"/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">永久卡地址</label>
	  <div class="col-sm-10"><input type="text" name="kmurl3" value="<?php echo $conf['kmurl3']; ?>" class="form-control"/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">补领10颗地址</label>
	  <div class="col-sm-10"><input type="text" name="blurl1" value="<?php echo $conf['blurl1']; ?>" class="form-control"/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">补领20颗地址</label>
	  <div class="col-sm-10"><input type="text" name="blurl2" value="<?php echo $conf['blurl2']; ?>" class="form-control"/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">补领30颗地址</label>
	  <div class="col-sm-10"><input type="text" name="blurl3" value="<?php echo $conf['blurl3']; ?>" class="form-control"/></div>
	</div><br/>
	<div class="form-group">
	  <label class="col-sm-2 control-label">密码重置</label>
	  <div class="col-sm-10"><input type="text" name="pwd" value="" class="form-control" placeholder="不修改请留空"/></div>
	</div><br/>
	<div class="form-group">
	  <div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="修改" class="btn btn-primary form-control"/><br/>
	 </div>
	</div>
  </form>
</div>
</div>
<script>
var items = $("select[default]");
for (i = 0; i < items.length; i++) {
	$(items[i]).val($(items[i]).attr("default"));
}
</script>
<?php
}?>

    </div>
  </div>