<?php
/*
 +----------------------------------------------------------------------
 | TEMMOKUMVC [ NO BEST , ONLY BETTER ]
 +----------------------------------------------------------------------
 | Copyright (c) 2018~2019 https://www.temmoku.cn All rights reserved.
 +----------------------------------------------------------------------
 | Author: 张宗强 Email:webmaster@temmoku.cn QQ:158726877 516669373 TEL:17895221001 微信:temmokumvc
 +---------------------------------------------------------------------- 
*/
namespace plugin\verification_code\admin\controller;
use \temmoku\controller;
use \temmoku\db;
use plugin\verification_code\public_class\cache;
class index extends controller{
	public function set(){
		
		if('post'===$_POST['step']){
			foreach($_POST['web'] AS $key=>$name){
				$one=db::select('*')->from(P_jab."set")->where("u_key LIKE '$key' ")->row();
				if($one){
					db::update(P_jab."set")->cols(array('u_value'))->where("u_key LIKE '$key'")->bindValue('u_value', "$name")->query();
				}else{
					db::insert(P_jab."set")->cols(array('u_key'=>"$key",'u_value'=>"$name"))->query();
				}
			}
			cache::setting_cache();
			$this->success('修改成功');
		}
		$_settingDB=db::select('*')->from(P_jab."set")->query();
    	foreach($_settingDB AS $row){
    		$settingDB[$row['u_key']]=$row['u_value'];
    	}
		$this->assign('settingDB',$settingDB);
		$this->display(tpl('set'));
	}
	
}
?>