<?php
define('CURSCRIPT','credit');

require dirname(__FILE__)."/global.php";
require MYMPS_INC."/db.class.php";

$defaultrank = array(
	'com_certify' => '+50',
	'per_certify' => '+50',
	'coin_credit' => '+10'
);

if(!submit_check(CURSCRIPT.'_submit')){

	!chk_adm_purview("purview_积分信用等级")&& write_msg("很抱歉，您所在会员组没有当前菜单的操作权限！");
	$here = '信用值增减设置';
	require MYMPS_DATA.'/moneytype.inc.php';
	
	$credit = $db->getOne("SELECT value FROM `{$db_mymps}config` WHERE type='credit_sco' AND description = 'credit'");
	$credit = $credit ? ($charset == 'utf-8' ? utf8_unserialize($credit) : unserialize($credit)) : array(
		'rank' => $defaultrank
	);
	include(mayi_tpl(CURSCRIPT));
	
}else{
	
	$db->query("DELETE FROM `{$db_mymps}config` WHERE description = 'credit' AND type = 'credit_sco'");
	$db->query("INSERT INTO `{$db_mymps}config` (description,value,type) values ('credit','".serialize($credit_new)."','credit_sco')");
	clear_cache_files('credit_score');
	write_msg('信用增减设置更新成功！','credit.php','WriteRecord');
	
}

is_object($db) && $db->Close();
$mymps_global = $db = $db_mymps = $part = NULL;
?>