<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
	$r=cache_read('module.cache.php',DIRCMS_ROOT.'data/cache_module/');
	$r=$r['order']['roleid']; 
	if(!in_array($_roleid,$r) && $_userid!=ADMIN_FOUNDERS)showmsg_nourl('您没有该操作的权限!');
	$action=empty($action)?'manage':trim($action);
	require_once(DIRCMS_ROOT.'include/list.class.php');
	$l=new dircmslist();
	switch($action)
	{
		case 'manage':
			$where=1;
			$where=$type?$where." AND `type`='{$type}'":$where;
			if($type && !in_array($type,array('amount','point')))showmsg('错误的请求!');
			$field=$field?$field:'username';		
			if(!in_array($field,array('username','inputer')))showmsg('错误的请求!');
			$k=trim(preg_replace('/[!@#\$%\^&\*\(\):\'\"\{\}\[\]\.\?\,\/`\;]+/i','',$k));
			$where=!empty($k)?$where." AND `{$field}` like '%".$k."%'":$where;
			$orderby="id DESC";
			$page=max(isset($page)?intval($page):1,1);
			$result=$l->getlist(DB_PRE.'pay_exchange',$where,$orderby,$page,15);
			$pages=$l->pages;
			include admin_tlp('buylog_manage');
			break;
		case 'delete':
			if(!$id)showmsg('请选择需要删除的记录!');
			$id=array_map('intval',!is_array($id)?array($id):$id);
			$db->mysql_delete(DB_PRE.'pay_exchange',$id);
			showmsg($LANG['MANAGE_SUCEESS'],ADMIN_FILE.'?file=buylog&action=manage');
			break;
	}
?>
