<?php
$wind_in='mb';
require_once('global.php');
require_once(R_P.'require/forum.php');
@extract($db->get_one("SELECT newmember AS bbsnewer ,totalmember as count FROM pw_bbsinfo WHERE id=1"));
/**
* 用户组权限判断
*/
$gp_allowmember==0 && Showmsg('member_right');
require_once(R_P.'require/header.php');
list($db_moneyname,$db_moneyunit,$db_rvrcname,$db_rvrcunit,$db_creditname,$db_creditunit)=explode("\t",$db_credits);
$db_maxmember && $page>$db_maxmember && $page=$db_maxmember;
if(!is_numeric($page) || $page<1){
	$page=1;
}
$numofpage=$count%$db_perpage==0 ? floor($count/$db_perpage) : floor($count/$db_perpage)+1;
$numofpage && $page>$numofpage && $page=$numofpage;
$pages=numofpage($count,$page,$numofpage,"member.php?orderway=$orderway&asc=$asc&",$db_maxmember);
$start=($page-1)*$db_perpage;
$orderarray=array(
				'1'=>'uid',
				'2'=>'username',
				'3'=>'thisvisit',
				'4'=>'postnum',
				'5'=>'digests',
				'6'=>'rvrc',
				'7'=>'money',
			);

$orderby=is_numeric($orderway) ? $orderarray[$orderway] : false;

!$orderby && $orderby='uid';
if($orderby=='uid' || $orderby=='username'){
	$sql_table="pw_members m LEFT JOIN pw_memberdata md USING(uid)";
} else{
	$sql_table="pw_memberdata md LEFT JOIN pw_members m USING(uid)";
}
$asc=$asc=='ASC'? 'ASC' :'DESC';
$memberdb=array();
$query = $db->query("SELECT m.uid,m.username,m.email,m.gender,m.regdate,m.oicq,m.site,m.location,md.postnum,md.digests,md.rvrc,md.money,md.thisvisit FROM $sql_table ORDER BY $orderby $asc LIMIT $start,$db_perpage");
while($member=$db->fetch_array($query)){
	$member['site'] && $member['site']="<a href='$member[site]' target='_blank'>view website</a>";
	$member['regdate']=get_date($member['regdate'],"Y-m-d");
	$member['thisvisit']=get_date($member['thisvisit']);//就是这次他登陆的时间
	$member['rvrc']=floor($member['rvrc']/10);
	$memberdb[]=$member;
}
require_once(PrintEot('member'));footer();
?>