www.gusucode.com > 08CMS空白站群系统 3.3 繁体 UTF-8 > upload/admina/records.inc.php

    <?
(!defined('M_COM') || !defined('M_ADMIN')) && exit('No Permission');
aheader();
!in_array($action, array('badlogin','adminlog','currencylog')) && amessage(lang('noexist record'));
$aps = array('badlogin' => 109,'adminlog' => 110,'currencylog' => 111);
!checkapermission($aps[$action]) && amessage(lang('no_apermission'));
if($sid && $sid_self) amessage(lang('msite admin item !'));
unset($aps);
$rname = $action;
$yearmonth = date('Ym',$timestamp);
$recorddir = M_ROOT.'./dynamic/records/';
$recordfile = $recorddir.$yearmonth.'_'.$rname.'.php';

$records = (array)@file($recordfile);
$filesize = @filesize($recordfile);

if($filesize < 500000){
	$dir = opendir($recorddir);
	$length = strlen($rname);
	$maxid = $id = 0;
	while($file = readdir($dir)){
		if(in_str($yearmonth.'_'.$rname,$file)) {
			$id = intval(substr($file, $length + 8));
			$id > $maxid && $maxid = $id;
		}
	}
	closedir($dir);

	if($maxid){
		$rnamefile2 = $recorddir.$yearmonth.'_'.$rname.'_'.$maxid.'.php';
	}else{
		$lastyearmonth = date('Ym',$timestamp - 86400 * 28);
		$rnamefile2 = $recorddir.$lastyearmonth.'_'.$rname.'.php';
	}

	if(file_exists($rnamefile2) && $records2 = @file($rnamefile2)) {
		$records = array_merge($records2, $records);
	}
}

$page = empty($page) ? 1 : max(1,intval($page));
$start = ($page - 1) * $atpp;
$records = array_reverse($records);
$num = count($records);
$multi = multi($num,$atpp,$page,"?entry=records&action=$action");
$records = array_slice($records,$start,$atpp);

if($action == 'badlogin'){
	$itemrecord = '';
	$no = $start;
	foreach($records as $recordstr){
		$record = explode("\t",$recordstr);
		if(empty($record[1])){
			continue;
		}
		$no ++;
		$record[1] = date('y-n-j H:i',$record[1]);
		$itemrecord .= "<tr><td align=\"center\" class=\"item1\" width=\"50\">$no</td>\n".
			"<td class=\"item2\">$record[2]</td>\n".
			"<td class=\"item1\">$record[3]</td>\n".
			"<td align=\"center\" class=\"item2\" width=\"120\">$record[4]</td>\n".
			"<td align=\"center\" class=\"item1\" width=\"120\">$record[1]</td></tr>\n";
	}
	tabheader(lang('login errorrecord'),'','',7);
	trcategory(array(lang('sn'),lang('try user cname'),lang('try password'),'IP'.lang('address'),lang('operate time')));
	echo $itemrecord;
	tabfooter();
	echo $multi;

}elseif($action == 'adminlog'){
	$itemrecord = '';
	foreach($records as $recordstr){
		$record = explode("\t",$recordstr);
		if(empty($record[1])){
			continue;
		}
		$record[1] = date('y-n-j H:i',$record[1]);
		$itemrecord .= "<tr><td align=\"center\" class=\"item1\" width=\"40\">$record[2]</td>\n".
			"<td class=\"item2\" width=\"80\">$record[3]</td>\n".
			"<td align=\"center\" class=\"item1\" width=\"80\">$record[4]</td>\n".
			"<td align=\"center\" class=\"item2\" width=\"80\">$record[5]</td>\n".
			"<td class=\"item1\">$record[6]</td>\n".
			"<td class=\"item2\">$record[7]</td>\n".
			"<td align=\"center\" class=\"item1\" width=\"90\">$record[1]</td></tr>\n";
	}
	tabheader(lang('admin operaterecord'),'','',7);
	trcategory(array(lang('user id'),lang('user cname'),lang('usergroup'),'IP'.lang('address'),lang('operate'),lang('detail'),lang('time')));
	echo $itemrecord;
	tabfooter();
	echo $multi;
}elseif($action == 'currencylog'){
	$itemrecord = '';
	foreach($records as $recordstr){
		$record = explode("\t",$recordstr);
		if(empty($record[1])){
			continue;
		}
		$record[1] = date('y-n-j H:i',$record[1]);
		$itemrecord .= "<tr><td align=\"center\" class=\"item1\" width=\"40\">$record[2]</td>\n".
			"<td class=\"item2\" width=\"80\">$record[3]</td>\n".
			"<td align=\"center\" class=\"item1\" width=\"60\">$record[4]</td>\n".
			"<td align=\"center\" class=\"item2\" width=\"40\">$record[5]</td>\n".
			"<td align=\"center\" class=\"item1\" width=\"40\">$record[6]</td>\n".
			"<td class=\"item2\">$record[7]</td>\n".
			"<td align=\"center\" class=\"item1\" width=\"90\">$record[1]</td></tr>\n";
	}
	tabheader(lang('crrecord'),'','',7);
	trcategory(array(lang('user id'),lang('user cname'),lang('currency type'),lang('mode1'),lang('amount'),lang('reason'),lang('time')));
	echo $itemrecord;
	tabfooter();
	echo $multi;
}
?>