<?php
/*
 * 安全配置
 * ============================================================================
 * 版权所有: 快范网络，并保留所有权利。
 * 网站地址: http://www.kuaifan.net；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 */
if(!defined('IN_KUAIFAN')) exit('Access Denied!');



if (!empty($_POST['dosubmit'])){
	$links[0]['title'] = '返回后台首页';
	$links[0]['href'] = $_admin_indexurl;
	$verification = array();
	foreach($_POST as $k => $v){
		if (substr($k, 0, 13) == "verification_") {
			$verification[substr($k, 13)] = $v;
		}else{
			!$db->query("UPDATE ".table('peizhi')." SET `value`='{$v}' WHERE `name`='{$k}'")?showmsg("系统提醒", "更新设置失败！", $links):"";
		}
	}
	!$db->query("UPDATE ".table('peizhi_mokuai')." SET `setting`='".array2string($verification)."' WHERE `module`='yanzhengma'")?showmsg("系统提醒", "验证码启动设置失败！", $links):"";
	refresh_cache('peizhi');
	refresh_peizhi_mokuai('yanzhengma');
	if ($_GET['c'] == 'anquan'){
		admin_log("修改了安全配置。", $admin_val['name']);
	}else{
		admin_log("修改了网站配置。", $admin_val['name']);
	}
	$links[1]['title'] = '继续配置';
	$links[1]['href'] = get_link();
	$links = array_reverse($links);
	showmsg("系统提醒", "保存成功！", $links);
}
$verification = $db -> getone("select * from ".table('peizhi_mokuai')." WHERE module='yanzhengma'");
$smarty->assign('verification',string2array($verification['setting']));
$smarty->assign('peizhi',get_cache('peizhi'));
?>