<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	printFooter();
	exit;
}
$arrNav["{$user_search}"] = 'red';
if( $forum_chansetting[0] == 1 ){
	$tmpNav = ' | <a href="?doaction=user_search&user_search=13"><font color="'.($user_search==='13'?'red':'').'">'.$lang['tpl.str1'].'</font></a>';
}
if( $doaction === '' ){
	$MainMenuColor = 'red';
}
?>

<!--Start Header Block-->
<br>
<table cellpadding="0" cellspacing="0" border="0" class="tableborder" align="center">
	<tr>
		<td align="left" colspan="14" height="23" class="tit1"><?=$lang['tpl.str2']?></td>
	</tr>
	<tr align="left">
	<td class="forumrow1" style="text-align:center;">
		<input type="submit" name="Submit" value="<?=$lang['tpl.str3']?>" style="color: #FF0000;width:80px;height:50px;border:1px outset;">
	</td>
	<td class="forumrow1" colspan="13"><?=$lang['tpl.str4']?></td>
	</tr>
	<tr align="left">
	<td colspan="14">
		<table border="0" cellspacing="0" cellpadding="0" width="100%">
		<tr>
			<td height="25" align="center" <?if($doaction=='' or $doaction=='user_search' && $user_search==''){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="user.php"><font color="<?if($doaction=='' or $doaction=='user_search' && $user_search==''){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str6']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==1 or $doaction=='user_permission' or $doaction=='modify' or $doaction=='user_board_permission'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=1"><font color="<?if($doaction=='user_search' && $user_search==1 or $doaction=='user_permission' or $doaction=='modify' or $doaction=='user_board_permission'){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str7']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==2){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=2"><font color="<?if($doaction=='user_search' && $user_search==2){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str8']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==3){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=3"><font color="<?if($doaction=='user_search' && $user_search==3){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str9']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==4){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=4"><font color="<?if($doaction=='user_search' && $user_search==4){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str10']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==5){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=5"><font color="<?if($doaction=='user_search' && $user_search==5){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str11']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==6){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=6"><font color="<?if($doaction=='user_search' && $user_search==6){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str12']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==7){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>> <a href="?doaction=user_search&user_search=7"><font color="<?if($doaction=='user_search' && $user_search==7){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str13']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==8){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=8"><font color="<?if($doaction=='user_search' && $user_search==8){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str14']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==11){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=11"><font color="<?if($doaction=='user_search' && $user_search==11){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str15']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==12){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>> <a href="?doaction=user_search&user_search=12"><font color="<?if($doaction=='user_search' && $user_search==12){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str16']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==14){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=14"><font color="<?if($doaction=='user_search' && $user_search==14){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str17']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='user_search' && $user_search==15){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=user_search&user_search=15"><font color="<?if($doaction=='user_search' && $user_search==15){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str18']?></font></a></td>
			<td height="25" align="center" <?if($doaction=='unite_user'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>><a href="?doaction=unite_user"><font color="<?if($doaction=='unite_user'){echo 'red';}else{echo '#000000';}?>"><?=$lang['tpl.str20']?></font></a></td>
		</tr>
		</table>
	</td>
	</tr>
<!--End Header Block-->

<!--Start Body Block-->
<?
include_once CACHE_PATH.'forum_setting.php';
require_once ROOT_PATH.'templates/'.$_DCACHE['settings']['styletpl'].'/grouppermission.tpl.php';
if( $doaction === '' ){
?>
<!--Start Default Block-->
	<form action="?doaction=user_search" method="post">
		<tr>
			<td align="left" colspan="14" class="tdtit"><?=$lang['tpl.str21']?></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str22']?></td>
			<td width="80%" class="forumrow" colspan="13"><?=$lang['tpl.str23']?></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str24']?></td>
			<td width="80%" class="forumrow" colspan="13"><input size="45" name="searchmax" type="text" value="100"></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str25']?></td>
			<td width="80%" class="forumrow" colspan="13"><input size="45" name="username" type="text">&nbsp;<input type="radio" name="usernamepreg" value="1" checked><?=$lang['tpl.str26']?><input type="radio" name="usernamepreg" value="2"><?=$lang['tpl.str27']?><input type="radio" name="usernamepreg" value="3"><?=$lang['tpl.str28']?></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str29']?></td>
			<td width="80%" class="forumrow" colspan="13">
				<select size=1 name="usergroups">
				<option value=0><?=$lang['tpl.str30']?></option>
<?
					$_DBUserGroups =& getUserGroups();
					if( !empty($_DBUserGroups) && is_array($_DBUserGroups) ){
						foreach( $_DBUserGroups as $currResult ){
							?>
							<option value="<?=$currResult['usergroupid']?>"><?=SysGroupName($currResult['parentgid']).$currResult['usertitle']?></option>
							<?
						}
					}
?>
				</select>
			</td>
		</tr>
		<tr>
			<td width="20%" class="forumrow">Email</td>
			<td width="80%" class="forumrow" colspan="13"><input size="45" name="useremail" type="text">&nbsp;<input type="radio" name="useremailpreg" value="1" checked><?=$lang['tpl.str26']?><input type="radio" name="useremailpreg" value="2"><?=$lang['tpl.str27']?><input type="radio" name="useremailpreg" value="3"><?=$lang['tpl.str28']?></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str31']?></td>
			<td width="80%" class="forumrow" colspan="13"><input size="45" name="userim" type="text">&nbsp;<input type="radio" name="userimpreg" value="1" checked><?=$lang['tpl.str26']?><input type="radio" name="userimpreg" value="2"><?=$lang['tpl.str27']?><input type="radio" name="userimpreg" value="3"><?=$lang['tpl.str28']?></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str32']?></td>
			<td width="80%" class="forumrow" colspan="13"><input size="45" name="lastip" type="text">&nbsp;<input type="radio" name="lastippreg" value="1" checked><?=$lang['tpl.str26']?><input type="radio" name="lastippreg" value="2"><?=$lang['tpl.str27']?><input type="radio" name="lastippreg" value="3"><?=$lang['tpl.str28']?></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str322']?></td>
			<td width="80%" class="forumrow" colspan="13"><input size="45" name="usertitle" type="text">&nbsp;<input type="radio" name="usertitlepreg" value="1" checked><?=$lang['tpl.str26']?><input type="radio" name="usertitlepreg" value="2"><?=$lang['tpl.str27']?><input type="radio" name="usertitlepreg" value="3"><?=$lang['tpl.str28']?></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str33']?></td>
			<td width="80%" class="forumrow" colspan="13"><input size="45" name="sign" type="text">&nbsp;<input type="radio" name="signpreg" value="1" checked><?=$lang['tpl.str26']?><input type="radio" name="signpreg" value="2"><?=$lang['tpl.str27']?><input type="radio" name="signpreg" value="3"><?=$lang['tpl.str28']?></td>
		</tr>
		<tr>
			<td width="20%" class="forumrow"><?=$lang['tpl.str34']?></td>
			<td width="80%" class="forumrow" colspan="13"><input size="45" name="userinfo" type="text">&nbsp;<input type="radio" name="userinfopreg" value="1" checked><?=$lang['tpl.str26']?><input type="radio" name="userinfopreg" value="2"><?=$lang['tpl.str27']?><input type="radio" name="userinfopreg" value="3"><?=$lang['tpl.str28']?></td>
		</tr>
		<!--shinzeal加入特殊搜索-->
		<tr>
			<td align="left" colspan="14" height="23" class="tit1"><?=$lang['tpl.str35']?></td>
		</tr>
		<tr>
			<td class="forumrow" colspan="14">
				<table id="Table1" width="100%" border="0">
					<tr>
						<td width="50%" class="forumrow1"><?=$lang['tpl.str36']?><input type="radio" value="more" name="loginr" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="loginr">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="logint" type="text"> <?=$lang['tpl.str39']?></td>
						<td width="50%" class="forumrow1"><?=$lang['tpl.str40']?><input type="radio" value="more" name="vanishr" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="vanishr">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="vanisht" type="text"> <?=$lang['tpl.str392']?></td>
					</tr>
					<tr>
						<td class="forumrow1"><?=$lang['tpl.str41']?><input type="radio" value="more" name="regr" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="regr">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size=5 name="regt" type="text"> <?=$lang['tpl.str392']?></td>
						<td class="forumrow1"><?=$lang['tpl.str42']?><input type="radio" value="more" name="artcler" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="artcler">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size=5 name="artclet" type="text"> <?=$lang['tpl.str43']?></td>
					</tr>

					<tr>
						<td class="forumrow1"><?=$lang['tpl.str44']?><input type="radio" value="more" name="uwealth" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="uwealth">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size=5 name="uwealthvalue" type="text"></td>
						<td class="forumrow1"><?=$lang['tpl.str45']?><input type="radio" value="more" name="uep" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="uep">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="uepvalue" type="text"></td>
					</tr>
					<tr>
						<td class="forumrow1"><?=$lang['tpl.str46']?><input type="radio" value="more" name="ucp" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="ucp">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="ucpvalue" type="text"></td>
						<td class="forumrow1"><?=$lang['tpl.str47']?><input type="radio" value="more" name="upower" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="upower">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="upowervalue" type="text"></td>
					</tr>
					<tr>
						<td class="forumrow1"><?=$lang['tpl.str48']?><input type="radio" value="more" name="umoney" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="umoney">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="umoneyvalue" type="text"></td>
						<td class="forumrow1"><?=$lang['tpl.str49']?><input type="radio" value="more" name="uticket" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="uticket">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="uticketvalue" type="text"></td>
					</tr>
					<tr>
						<td class="forumrow"><LI><?=$lang['tpl.str50']?></LI></td>
					</tr>
					<tr>
						<td class="forumrow1"><?=$lang['tpl.str51']?><input type="radio" value="more" name="uvipstartime" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="uvipstartime">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="uvipstartimevalue" type="text"></td>
						<td class="forumrow1"><?=$lang['tpl.str52']?><input type="radio" value="more" name="uvipendtime" checked>&nbsp;<?=$lang['tpl.str37']?>&nbsp;<input type="radio" value="less" name="uvipendtime">&nbsp;<?=$lang['tpl.str38']?>&nbsp;&nbsp;<input size="5" name="uvipendtimevalue" type="text"></td>
					</tr>
				</table>
			</td>
		</tr>

		<!--特殊搜索结束-->
		<tr>
			<td width="100%" class="forumrow" align="center" colspan="14" style="text-align:center;"><input name="submit" type="submit" class="button" value="   <?=$lang['tpl.str53']?>   "></td>
		</tr>
		<input type="hidden" value="9" name="user_search">
	</form>
<!--End Default Block-->
<?
} elseif( $doaction === 'user_search' ){//用户搜索结果项
	$currPage = intval($page);
	if( $currPage < 1 ){
		$currPage = 1;
	}
	$fldList = 'u.userid,u.username,u.useremail,u.lastlogin,u.userlastip,u.userpost,u.usergroupid,u.vip_startime,u.vip_endtime';
	$stmt = '';
	$countStmt = '';
	$pageSize = intval($forum_setting[11]);
	if( $pageSize < 1 ){
		$pageSize = 10;
	}
	switch(intval($user_search)){
		case 1:
			$stmt = "SELECT {$fldList} FROM {$dv}user u ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u";
			break;
		case 2:
			$stmt = "SELECT {$fldList} FROM {$dv}user u ORDER BY u.userpost DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u";
			$pageSize = 100;
			break;
		case 3:
			$stmt = "SELECT {$fldList} FROM {$dv}user u ORDER BY u.userpost";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u";
			$pageSize = 100;
			break;
		case 4:
			//$dateDiff = dateAdd('h',-25,date('Y-m-d H:i:s'));
			$dateDiff = dateAdd('h',-25,gmdate('Y-m-d 23:59:59'));
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.lastlogin>'{$dateDiff}' ORDER BY u.lastlogin DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE u.lastlogin>'{$dateDiff}'";
			break;
		case 5:
			//$dateDiff = dateAdd('h',-25,date('Y-m-d H:i:s'));
			$dateDiff = dateAdd('h',-25,gmdate('Y-m-d 23:59:59'));
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.joindate>'{$dateDiff}' ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE  u.joindate>'{$dateDiff}'";
			break;
		case 6:
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.usergroupid=5 ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE u.usergroupid=5";
			break;
		case 7:
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.usergroupid=6 ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE u.usergroupid=6";
			break;
		case 8:
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.usergroupid<4 ORDER BY u.usergroupid";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE u.usergroupid<4";
			break;
		case 9:
			//$whereStmt = " WHERE 1=1 ";
			if( $searchmax <= 0 ){
				$searchmax = 20;
			}
			$pageSize = $searchmax;
			//用户名
			$username = trim($username);
			if( $username !== '' ){
				if( $usernamepreg === '1' ){
					$whereStmt .= " AND u.username='{$username}' ";
				} elseif( $usernamepreg === '2' ){
					$whereStmt .= " AND u.username LIKE '{$username}%' ";
				} else{
					$whereStmt .= " AND u.username LIKE '%{$username}%' ";
				}
			}
			//用户组
			if( $usergroups > 0 ){
				$whereStmt .= " AND u.usergroupid='{$usergroups}'";
			}
			//登录次数
			$logint = trim($logint);
			if( is_numeric($logint) ){
					$whereStmt .= " AND u.userlogins>='{$logint}' ";
				if( $loginr == 'more' ){
				} else{
					$whereStmt .= " AND u.userlogins<='{$logint}' ";
				}
			}
			//消失天数
			$vanisht = trim($vanisht);
			if( is_numeric($vanisht) ){
				if( $vanishr == 'more' ){
					$whereStmt .= " AND u.lastlogin<='".dateAdd('d',-$vanisht,time(), '')."' ";
				} else{
					$whereStmt .= " AND u.lastlogin>='".dateAdd('d',-$vanisht,time(), '')."' ";
				}
			}
			//注册天数
			$regt = trim($regt);
			if( is_numeric($regt) ){
				if( $regr == 'more' ){
					$whereStmt .= " AND u.joindate<='".dateAdd('d',-$regt,time(), '')."' ";
				} else{
					$whereStmt .= " AND u.joindate>='".dateAdd('d',-$regt,time(), '')."' ";
				}
			}
			//发表帖数
			$artclet = trim($artclet);
			if( is_numeric($artclet) ){
				if( $artcler == 'more' ){
					$whereStmt .= " AND u.userpost>='{$artclet}' ";
				} else{
					$whereStmt .= " AND u.userpost<='{$artclet}' ";
				}
			}
			//用户金钱
			$uwealthvalue = trim($uwealthvalue);
			if( is_numeric($uwealthvalue) ){
				if( $uwealth == 'more' ){
					$whereStmt .= " AND u.userwealth>='{$uwealthvalue}' ";
				} else{
					$whereStmt .= " AND u.userwealth<='{$uwealthvalue}' ";
				}
			}
			//用户经验
			$uepvalue = trim($uepvalue);
			if( is_numeric($uepvalue) ){
				if( $uep == 'more' ){
					$whereStmt .= " AND u.userep>='{$uepvalue}' ";
				} else{
					$whereStmt .= " AND u.userep<='{$uepvalue}' ";
				}
			}
			//用户魅力
			$ucpvalue = trim($ucpvalue);
			if( is_numeric($ucpvalue) ){
				if( $ucp == 'more' ){
					$whereStmt .= " AND u.usercp>='{$ucpvalue}' ";
				} else{
					$whereStmt .= " AND u.usercp<='{$ucpvalue}' ";
				}
			}
			//用户威望
			$upowervalue = trim($upowervalue);
			if( is_numeric($upowervalue) ){
				if( $upower == 'more' ){
					$whereStmt .= " AND u.userpower>='{$upowervalue}' ";
				} else{
					$whereStmt .= " AND u.userpower<='{$upowervalue}' ";
				}
			}
			//用户金币
			$umoneyvalue = trim($umoneyvalue);
			if( is_numeric($umoneyvalue) ){
				if( $umoney == 'more' ){
					$whereStmt .= " AND u.usermoney>='{$umoneyvalue}' ";
				} else{
					$whereStmt .= " AND u.usermoney<='{$umoneyvalue}' ";
				}
			}
			//用户点券
			$uticketvalue = trim($uticketvalue);
			if( is_numeric($uticketvalue) ){
				if( $uticket == 'more' ){
					$whereStmt .= " AND u.userticket>='{$uticketvalue}' ";
				} else{
					$whereStmt .= " AND u.userticket<='{$uticketvalue}' ";
				}
			}
			//Vip登记时间
			$uvipstartimevalue = trim($uvipstartimevalue);
			if( is_numeric($uvipstartimevalue) ){
				if( $uvipstartime == 'more' ){
					$whereStmt .= " AND u.vip_startime<='".dateAdd('d',-$uvipstartimevalue,time(), '')."' ";
				} else{
					$whereStmt .= " AND u.vip_startime>='".dateAdd('d',-$uvipstartimevalue,time(), '')."' ";
				}
			}
			//Vip截止时间
			$uvipendtimevalue = trim($uvipendtimevalue);
			if( is_numeric($uvipendtimevalue) ){
				if( $uvipendtime == 'more' ){
					$whereStmt .= " AND u.vip_endtime<='".dateAdd('d',-$uvipendtimevalue,time(), '')."' ";
				} else{
					$whereStmt .= " AND u.vip_endtime>='".dateAdd('d',-$uvipendtimevalue,time(), '')."' ";
				}
			}
			//Email搜索
			$useremail = trim($useremail);
			if( $useremail != '' ){
				if( $useremailpreg === '1' ){
					$whereStmt .= " AND u.useremail='{$useremail}' ";
				} elseif( $useremailpreg === '2' ){
					$whereStmt .= " AND u.useremail LIKE '{$useremail}%' ";
				} else{
					$whereStmt .= " AND u.useremail LIKE '%{$useremail}%' ";
				}
			}
			//用户IM搜索
			$userim = trim($userim);
			if( $userim !== '' ){
				if( $userimpreg === '1' ){
					$whereStmt .= " AND u.userim='{$userim}' ";
				} elseif( $userimpreg === '2' ){
					$whereStmt .= " AND u.userim LIKE '{$userim}%' ";
				} else{
					$whereStmt .= " AND u.userim LIKE '%{$userim}%' ";
				}
			}
			//登录IP搜索
			$lastip = trim($lastip);
			if( $lastip !== '' ){
				if( $lastippreg === '1' ){
					$whereStmt .= " AND u.userlastip='{$lastip}' ";
				} elseif( $lastippreg === '2' ){
					$whereStmt .= " AND u.userlastip LIKE '{$lastip}%' ";
				} else{
					$whereStmt .= " AND u.userlastip LIKE '%{$lastip}%' ";
				}
			}
			//头衔包含
			$usertitle = trim($usertitle);
			if( $usertitle !== '' ){
				if( $usertitlepreg === '1' ){
					$whereStmt .= " AND u.usertitle='{$usertitle}' ";
				} elseif( $usertitlepreg === '2' ){
					$whereStmt .= " AND u.usertitle LIKE '{$usertitle}%' ";
				} else{
					$whereStmt .= " AND u.usertitle LIKE '%{$usertitle}%' ";
				}
			}
			//签名包含
			$sign = trim($sign);
			if( $sign !== '' ){
				if( $signpreg === '1' ){
					$whereStmt .= " AND u.usersign='{$sign}' ";
				} elseif( $signpreg === '2' ){
					$whereStmt .= " AND u.usersign LIKE '{$sign}%' ";
				} else{
					$whereStmt .= " AND u.usersign LIKE '%{$sign}%' ";
				}
			}
			//详细资料搜索
			$userinfo = trim($userinfo);
			if( $userinfo !== '' ){
				if( $userinfopreg === '1' ){
					$whereStmt .= " AND u.userinfo='{$userinfo}' ";
				} elseif( $userinfopreg === '2' ){
					$whereStmt .= " AND u.userinfo LIKE '{$userinfo}%' ";
				} else{
					$whereStmt .= " AND u.userinfo LIKE '%{$userinfo}%' ";
				}
			}
			if( $whereStmt != '' ){
				$whereStmt = "WHERE 1=1 {$whereStmt}";
			} else{
				printFooter();
				return show_msg($lang['tpl.str273'],$lang['tpl.str274']);
			}
			$stmt = "SELECT {$fldList} FROM {$dv}user u {$whereStmt} ORdER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u {$whereStmt}";
			break;
		case 10:
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.usergroupid='{$usergroupid}' ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE u.usergroupid='{$usergroupid}'";
			break;
		case 11:
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.lockuser=2 ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE u.lockuser=2";
			break;
		case 12:
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.lockuser=1 ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE u.lockuser=1";
			break;
		case 13:
			$stmt = "SELECT {$fldList} FROM {$dv}user u WHERE u.ischallenge=1 ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u WHERE u.ischallenge=1";
			break;
		case 14:
			$stmt = "SELECT {$fldList} FROM {$dv}user u INNER JOIN {$dv}useraccess ua ON ua.uc_userid=u.userid WHERE ua.uc_userid IS NOT NULL ORDER BY u.userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u INNER JOIN {$dv}useraccess ua ON ua.uc_userid=u.userid WHERE ua.uc_userid IS NOT NULL";
			break;
		case 15:
			$stmt = "SELECT {$fldList} FROM {$dv}user u /*!32312 USE INDEX(backend_vip_list) */ INNER JOIN {$dv}usergroups ug ON ug.usergroupid=u.usergroupid WHERE ug.usergroupid IS NOT NULL ORDER BY u.vip_endtime DESC,userid DESC";
			$countStmt = "SELECT COUNT(1) FROM {$dv}user u INNER JOIN {$dv}usergroups ug ON ug.usergroupid=u.usergroupid WHERE ug.usergroupid IS NOT NULL";
			break;
	}
	if( $stmt != '' && $countStmt != '' ){
		$totalrec = $db->scalar($countStmt);
		$_SearchResults =& $db->getResultSet($stmt,array('absolutePage'=>$currPage,'pageSize'=>$pageSize));
	}
?>
<!--Start User Search-->
<tr>
<td colspan="14" align="center" class="tdtit"><?=$lang['tpl.str54']?></td>
</tr>
<?
	$currPageRowCount = 0;
	if( !is_array($_SearchResults) || empty($_SearchResults) ){
		if( $user_search == 15 ){
			$strTmp = $lang['tpl.str55'];
		}
?>
<tr><td colspan="14" class="forumrow"><?=$lang['tpl.str56']?><?=$strTmp?></td></tr>
<?
	} else{
?>
	<FORM METHOD="POST" ACTION="?doaction=to_user">
	<tr align="center" height="23">
	<td class="forumrow2" width="10%"><B><?=$lang['tpl.str67']?></B></td>
	<td class="forumrow2" width="12%"><B><?=$lang['tpl.str68']?></B></td>
	<td class="forumrow2" width="8%"><B><?=$lang['tpl.str69']?></B></td>
	<td class="forumrow2" width="10%"><B><?=$lang['tpl.str70']?></B></td>
	<td class="forumrow2" width="15%"><B><?=$lang['tpl.str71']?></B></td>
	<td class="forumrow2" width="15%"><B><?=$lang['tpl.str72']?></B></td>
	<td class="forumrow2" width="20%"><B><?=$lang['tpl.str73']?></B></td>
	<td class="forumrow2" nowrap><B><?=$lang['tpl.str74']?></B></td>
	</tr>
<?
		foreach( $_SearchResults as $currResult ){
			$currEncUserName = urlencode($currResult['username']);
			if ($currResult['lastlogin'] != '' && is_numeric($currResult['lastlogin'])) {
				$varTmp = gmdate('Y-m-d H:i:s', $currResult['lastlogin']+getUserTimeZoneOffset());
			} else{
				$varTmp = '';
			}
			if( $currResult['usergroupid'] == 1 ){
				$strDisabled = ' disabled ';
			} else{
				$strDisabled = '';
			}
			if( intval($currResult['vip_startime']) === 0 ){
				$currResult['vip_startime'] = '';
			} else {
				$currResult['vip_startime'] = gmdate('Y-m-d H:i:s', $currResult['vip_startime']+getUserTimeZoneOffset());
			}
			if( intval($currResult['vip_endtime']) === 0 ){
				$currResult['vip_endtime'] = '';
			} else {
				$currResult['vip_endtime'] = gmdate('Y-m-d H:i:s', $currResult['vip_endtime']+getUserTimeZoneOffset());
			}
			$currEncUserLastIP = urlencode($currResult['userlastip']);
?>
	<tr>
		<td class="forumrow"><a href="?doaction=modify&userid=<?=$currResult['userid']?>"><?=$currResult['username']?></a></td>
		<td class="forumrow"><a href="mailto:<?=$currResult['useremail']?>"><?=$currResult['useremail']?></a></td>
		<td class="forumrow" align="center"><a href="?doaction=user_permission&userid=<?=$currResult['userid']?>&username=<?=$currEncUserName?>"><?=$lang['tpl.str75']?></a></td>
		<td class="forumrow" align="center"><a href="?doaction=fix&userid=<?=$currResult['userid']?>&username=<?=$currEncUserName?>"><?=$lang['tpl.str76']?></a></td>
		<td class="forumrow"><a href="lockip.php?userip=<?=$currEncUserLastIP?>" title="<?=$lang['tpl.str77']?>"><?=$currResult['userlastip']?></a></td>
		<td class="forumrow" ><?=$varTmp?></td>
		<td class="forumrow" align="center"><?=$currResult['vip_startime']?>/<?=$currResult['vip_endtime']?>
		</td>
		<td class="forumrow" align="center"><input type="checkbox" name="arr_user_id[]" value="<?=$currResult['userid']?>" <?=$strDisabled?> title="[Value=<?=$currResult['userid']?>]"></td>
	</tr>
<?
			$currPageRowCount++;
		}
		$pageCount = ceil((float)$totalrec/(float)$pageSize);
		if( $totalrec > 0 ){
			$searchStr = "?doaction={$doaction}&user_search={$user_search}&user_name=".urlencode($user_name)."&user_email=".urlencode($user_email)."&home_page=".urlencode($home_page)."&oicq=".urlencode($oicq)."&icq=".urlencode($icq)."&msn=".urlencode($msn)."&last_ip=".urlencode($last_ip)."&user_title=".urlencode($user_title)."&sign=".urlencode($sign)."&user_class=".urlencode($user_class)."&user_groups=".urlencode($usergroups)."&user_group_id=".$usergroupid."&login_r=".urlencode($login_r)."&login_t=".urlencode($login_t)."";
			$searchStr = '';
			foreach( $_GET as $key => $val){
				if( $searchStr !== '' ){
					$searchStr .= '&';
				}
				$searchStr .= "{$key}=".urlencode($val);
			}
			foreach( $_POST as $key => $val){
				if( $searchStr !== '' ){
					$searchStr .= '&';
				}
				$searchStr .= "{$key}=".urlencode($val);
			}
			$searchStr = '?'.$searchStr;
?>
	<tr><td colspan="14"><div style="height:26px;float:right;width:;">
<?
			echo pagelist($totalrec,$pageSize,$currPage,$searchStr,$currPageRowCount).'</div></td></tr>';
		}
?>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function OnActionSelected(radio){
		if( radio.value === '2' ){
			radio.form.sel_user_group.disabled = false;
		} else{
			radio.form.sel_user_group.disabled = true;
		}
	}
	//-->
	</SCRIPT>
	<tr>
		<td colspan="8" class="forumrow" align="center"><?=$lang['tpl.str78']?><input type="radio" name="user_action" value="1" onclick="OnActionSelected(this)"> <?=$lang['tpl.str79']?><input type="radio" name="user_action" value="3" onclick="OnActionSelected(this)"> <?=$lang['tpl.str80']?><input type="radio" name="user_action" value="2" checked onclick="OnActionSelected(this)"> <?=$lang['tpl.str81']?>
			<select size="1" name="sel_user_group">
<?
				$_DBUserGroups =& getUserGroups2();
				if( !empty($_DBUserGroups) && is_array($_DBUserGroups) ){
					foreach( $_DBUserGroups as $currResult ){
						print '--'.'><option value="'.$currResult['usergroupid'].'">'.SysGroupName($currResult['parentgid']).$currResult['usertitle'].'</option><!--';
					}
				}

?>
			</select>
		</td>
		<td class="forumrow" colspan="8" style="align:center;"><?=$lang['tpl.str82']?><input type="checkbox" value="on" name="chkall" onclick="InverseSelect(this)"></td>
	</tr>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function InverseSelect(chkbox){
		var form = chkbox.form;
		if( !form ){
			alert('{$lang['tpl.str83']}');
			return false;
		}
		for( var i = 0 ; i < form.elements.length ; i++ ){
			if( form.elements[i].type.toLowerCase() === 'checkbox' ){
				form.elements[i].checked = chkbox.checked;
			}
		}
	}
	//-->
	</SCRIPT>
	<tr>
		<td colspan="14" class="forumrow" style="text-align:center;">
			<input type="submit" class="button" name="submitBtn" value="<?=$lang['tpl.str84']?>"  onclick="if(confirm('<?=$lang['tpl.str85']?>')){return true;}else{return false;}">
		</td>
	</tr>
	</FORM>
	<!--End User Search-->
<?
	}
} elseif( $doaction === 'fix' ){//修复操作
	if( !is_numeric($userid) || $userid <= 0 ){
?>
<tr><td colspan="14" class="forumrow"><?=$lang['tpl.str86']?></td></tr>
<?
		return printFooter();
	}
	$UserName = $db->escape_string($db->scalar("SELECT username FROM {$dv}user WHERE userid='{$userid}'"));
	if( $UserName == '' ){
?>
<tr><td colspan="14" class="forumrow"><?=$lang['tpl.str87']?></td></tr>
<?
		return printFooter();
	}
	//修复所有数据表
	$UserArticle = 0;
	$tmpRs =& getAllPostTable();
	if( $tmpRs !== false ){
		foreach( $tmpRs as $val ){
			$currPostTable = $db->escape_string($val['tablename']);
			//计算用户发帖
			$UserArticle += $db->scalar("SELECT COUNT(1) FROM {$currPostTable} WHERE postuserid='{$userid}'");
		}
	}
	//修复精华
	$db->query("UPDATE {$dv}besttopic SET postuserid='{{$userid}}' WHERE postusername='{$UserName}'");
	$UserIsBest = $db->scalar("SELECT COUNT(1) FROM {$dv}besttopic WHERE postuserid='{{$userid}}'");
	//修复上传文件列表
	$db->query("UPDATE {$dv}upfile SET f_userid='{$userid}' WHERE f_username='{$username}'");
	//更新发帖数
	$db->query("UPDATE {$dv}user SET userpost='$UserArticle',userisbest='{$UserIsBest}' WHERE userid='{$userid}'");
	echo '--'.'><tr><td colspan="14">';
	show_msg($lang['tpl.str88'],$lang['tpl.str89']."<b>".$username."</b>".$lang['tpl.str90'],1);
	echo '</td></tr><!--';
} elseif( $doaction === 'to_user' ){//操作用户，删除用户信息相关操作
?>
<tr><td colspan="14 height="23" align="left" class="tit1"><?=$lang['tpl.str91']?></td></tr>
<?
	if( $user_action == '' ){
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str92']?></td></tr>
<?
		return printFooter();
	}
	if( empty($arr_user_id) ){
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str93']?></td></tr>
<?
		return printFooter();
	}
	$UserIDList = implode(',', $arr_user_id);
	switch(intval($user_action)){
		case 1://删除用户
			$UserNameList = '';
			if( is_array($arr_user_id) && checkIDList($UserIDList=implode(',',$arr_user_id)) === true ){
				if( $query = $db->query("SELECT username FROM {$dv}user WHERE userid IN({$UserIDList})") ){
					while( $result = $db->fetch_row($query) ){
						if( $UserNameList !== '' ){
							$UserNameList .= ',';
						}
						$UserNameList .= "'".$db->escape_string(trim($result[0]))."'";
					}
				}
				if( $UserNameList !== '' ){
					//删除用户的短信
					$db->query("UPDATE {$dv}message SET delr=1 WHERE incept IN({$UserNameList}) AND delr=0");
					$db->query("UPDATE {$dv}message SET dels=1 WHERE sender IN({$UserNameList}) AND dels=0 AND (issend=0 OR issend=1)");
					$db->query("DELETE FROM {$dv}message WHERE incept IN({$UserNameList}) AND delr=1");
					$db->query("UPDATE {$dv}message SET dels=2 WHERE sender IN({$UserNameList}) AND dels=1");
					$db->query("DELETE FROM {$dv}friend WHERE f_username IN({$UserNameList})");
					$db->query("DELETE FROM {$dv}bookmark WHERE username IN({$UserNameList})");
					//删除用户的帖子和精华
					$db->query("DELETE FROM {$dv}topic WHERE postuserid IN({$UserIDList})");
					$tmpRs =& getAllPostTable();
					if( $tmpRs !== false ){
						foreach( $tmpRs as $val ){
							$db->query("DELETE FROM ".$db->escape_string($val['tablename'])." WHERE postuserid IN({$UserIDList})");
						}
					}
					$db->query("DELETE FROM {$dv}besttopic WHERE postuserid IN({$UserIDList})");
					//删除用户上传表
					$db->query("DELETE FROM {$dv}upfile WHERE f_userid IN({$UserIDList})");
					$db->query("DELETE FROM {$dv}user WHERE userid IN({$UserIDList})");
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str95']?></td></tr>
<?
				}
			} else{
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str94']?></td></tr>
<?
				return printFooter();
			}
			break;
		case 2://移动到用户组
			if( !is_numeric($sel_user_group) ){
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str94']?></td></tr>
<?
				return printFooter();
			}
			$tmpRs =& $db->getResultSet("SELECT usertitle,grouppic FROM {$dv}usergroups WHERE usergroupid='{$sel_user_group}'");
			if( $tmpRs !== false ){
				$db->query("UPDATE {$dv}user SET usergroupid='{$sel_user_group}',userclass='".$db->escape_string($tmpRs[0]['usertitle'])."',titlepic='".$db->escape_string($tmpRs[0]['grouppic'])."' WHERE userid IN({$UserIDList})");
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str95']?></td></tr>
<?
				return printFooter();
			} else{
			}
			break;
		case 3://删除用户所有帖子
			if( !(!empty($arr_user_id) && is_array($arr_user_id)) ){
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str96']?></td></tr>
<?
				return printFooter();
			}
			$UserIDList = implode(',',$arr_user_id);
			if( checkIDList($UserIDList) === false ){
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str94']?></td></tr>
<?
				return printFooter();
			}
			$tmpRs =& getAllPostTable();
			$titlenum = 0;
			if( $tmpRs !== false ){
				foreach( $tmpRs as $val ){
					$currPostTable = $db->escape_string($val['tablename']);
					$query = $db->query("UPDATE {$currPostTable} SET locktopic=boardid,boardid=444,isbest='0' WHERE postuserid IN({$UserIDList})");
					$titlenum += $db->affected_rows($query);
					//如下代码仅在 MySQL 4.0.4或更高版本支持————代码注释A1（如下代码如果启用，可禁用代码注释A2的代码）
					//$db->query("UPDATE {$currPostTable} tbl INNER JOIN {$dv}topic t ON t.topicid=tbl.rootid SET tbl.locktopic=tbl.boardid,tbl.boardid=444,tbl.isbest='0' WHERE tbl.postuserid IN({$UserIDList})");
				}
			}
			$db->query("DELETE FROM {$dv}besttopic WHERE postuserid IN({$UserIDList})");
			//当代码注释A1启用时，如下代码可禁用————代码注释A2
			$tmpRs =& $db->getResultSet("SELECT topicid,posttable FROM {$dv}topic WHERE postuserid IN({$UserIDList})");
			if( $tmpRs !== false ){
				foreach( $tmpRs as $val ){
					$db->query("UPDATE ".$db->escape_string($val['posttable'])." SET locktopic=boardid,boardid=444,isbest='0' WHERE rootid='{$val['topicid']}'");
				}
			}
			$db->query("UPDATE {$dv}topic SET locktopic=boardid,boardid=444,isbest='0' WHERE postuserid IN({$UserIDList})");
			if( $titlenum <= 0 ) $titlenum = 0;
			$db->query("UPDATE {$dv}user SET userpost=userpost-{$titlenum},userwealth=userwealth-".($titlenum*$forum_user[3]).",userep=userep-".($titlenum*$forum_user[8]).",usercp=usercp-".($titlenum*$forum_user[13])." WHERE userid IN({$UserIDList})");
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str97']?></td></tr>
<?
			break;
		default:
?>
<tr><td colspan="14 class="forumrow"><?=$lang['tpl.str98']?></td></tr>
<?
			break;
	}
} elseif( $doaction === 'modify' ){//修改用户资料表单
?>
<tr><td colspan="14" height="23" align="left" class="tdtit"><?=$lang['tpl.str99']?></td></tr>
<?
	if( !is_numeric($userid) ){
		printFooter();
		return show_msg($lang['tpl.str100'],$lang['tpl.str101']);
	}
	$tmpRs =& $db->getResultSet("SELECT  userid,username,userpassword,useremail,userpost,usertopic,usersign,usersex,userface,userwidth,userheight,userim,joindate,lastlogin,userlogins,userviews,lockuser,userclass,usergroup,userwealth,userep,usercp,userpower,userdel,userisbest,usertitle,userbirthday,userquesion,useranswer,userlastip,userphoto,userfav,userinfo,usersetting,usergroupid,userhidden,titlepic,usermsg,ischallenge,usermobile,truepassword,usertoday,userisava,useravasetting,usermoney,userticket,followmsgid,vip_startime,vip_endtime,passport FROM {$dv}user WHERE userid='{$userid}'");
	if( $tmpRs === false ){
		printFooter();
		show_msg($lang['tpl.str102'],$lang['tpl.str103']);
		return;
	}
	$dbUserInfo =& $tmpRs[0];
	unset($tmpRs);
	if( $dbUserInfo['userinfo'] != '' ){
		$arrUserInfo = explode('|||',$dbUserInfo['userinfo']);
	} else{
		$arrUserInfo = array();
	}
	$arrUserIM = explode('|||',$dbUserInfo['userim']);
	$encUserName = urlencode($dbUserInfo['username']);
	?>
	<FORM METHOD="POST" ACTION="?doaction=save_user_info">
	<tr>
	<td width="100%" class="forumrow" valign="top" colspan="14"><?=$lang['tpl.str104']?> <?=$dbUserInfo['username']?> <?=$lang['tpl.str105']?><BR><BR>
	<a href="mailto:<?=$dbUserInfo['useremail']?>"><?=$lang['tpl.str106']?></a> | <a href="../messanger.php?action=new&touser=<?=$encUserName?>" target="_blank"><?=$lang['tpl.str107']?></a> | <a href="../dispuser.php?id=<?=$dbUserInfo['userid']?>" target="_blank"><?=$lang['tpl.str108']?></a> | <a href="../query.php?stype=1&nsearch=3&keyword=<?=$encUserName?>&searchdate=30" target="_blank"><?=$lang['tpl.str109']?></a> | <a href="../query.php?stype=6&nsearch=0&psearch=0&keyword=<?=$encUserName?>" target="_blank"><?=$lang['tpl.str110']?></a> | <a href="../query.php?stype=4&nsearch=0&psearch=0&keyword=<?=$encUserName?>" target="_blank"><?=$lang['tpl.str111']?></a> | <a href="../show.php?username=<?=$encUserName?>" target="_blank"><?=$lang['tpl.str112']?></a> | <a href="?doaction=user_permission&userid=<?=$dbUserInfo['userid']?>&username=<?=$encUserName?>"><?=$lang['tpl.str113']?></a> | <a href="../topicother.php?action=lookip&ip=<?=$dbUserInfo['userlastip']?>&t=1" target="_blank"><?=$lang['tpl.str114']?></a> | <a href="?doaction=touser&user_action=1&userid=<?=$dbUserInfo['userid']?>" onclick="return confirm('<?=$lang['tpl.str115']?>');"><?=$lang['tpl.str116']?></a>
	</td>
	</tr>
	<tr><td class="tit1" colspan="14" height="23" align="left"><?=$lang['tpl.str117']?><?=$lang['tpl.str276']?><?=$dbUserInfo['username']?></td></tr>
	<tr><td class="forumrow" height="23" align="left" colspan="6">
	<?=$lang['tpl.str118']?>
	</td></tr>
	<tr>
	<td width="20%" class="forumrow"><?=$lang['tpl.str119']?></td>
	<td width="80%" class="forumrow" colspan="13">
	<select size="1" name="user_groups">
<?
	$tmpRs =& getUserGroups();
	if( !empty($tmpRs) && is_array($tmpRs) ){
		foreach( $tmpRs as $currResult ){
			if( $dbUserInfo['usergroupid'] == $currResult['usergroupid'] ){
				$strSelected = ' selected ';
			} else{
				$strSelected = '';
			}
			$currGroupName = SysGroupName($currResult['parentgid']).$currResult['usertitle'];
			?>
<option value="<?=$currResult['usergroupid']?>" <?=$strSelected?>><?=$currGroupName?></option>
<?
		}
	}
	if( trim($dbUserInfo['userquesion']) !== '' ){
		$encUserQuestion = htmlspecialchars($dbUserInfo['userquesion']);
	}
	if( $dbUserInfo['usersex'] == 0 ){
		$sexChecked0 = ' checked ';
	} elseif( $dbUserInfo['usersex'] == 1 ){
		$sexChecked1 = ' checked ';
	}
	if( trim($dbUserInfo['userphoto']) !== '' ){
		$encUserPhoto = htmlspecialchars($dbUserInfo['userphoto']);
	}
	if( trim($dbUserInfo['useremail']) !== '' ){
		$encUserEmail = htmlspecialchars($dbUserInfo['useremail']);
	}
	foreach( $arrUserIM as $index => $currUserIM ){
		$arrEncUserIM[$index] = htmlspecialchars($currUserIM);
	}
	$arrUserFace = explode('|',$dbUserInfo['userface']);
	$encUserFace = htmlspecialchars($arrUserFace[count($arrUserFace)-1]);
	$encUserTitle = htmlspecialchars($dbUserInfo['usertitle']);
	$encUserSign = htmlspecialchars($dbUserInfo['usersign']);
	$dbUserInfo['joindate'] = gmdate('Y-m-d H:i:s', $dbUserInfo['joindate']+getUserTimeZoneOffset());
	$lastlogintime=gmdate('Y-m-d H:i:s',$dbUserInfo['lastlogin']+getUserTimeZoneOffset());
	if(!empty($dbUserInfo['userbirthday'])){
		$userbirthday=gmdate('Y-m-d',$dbUserInfo['userbirthday']+getUserTimeZoneOffset());
	}
	else{
		$userbirthday='1970-1-1';
	}
	?>
	</select>
	</td>
	</tr>
	<input name="userid" type="hidden" value="<?=$dbUserInfo['userid']?>">
	<tr>
	<td width="20%" class="forumrow"><?=$lang['tpl.str120']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="username" type=text value="<?=$dbUserInfo['username']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str121']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="password" type=text><?=$lang['tpl.str122']?></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str123']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="quesion" type=text value="<?=$encUserQuestion?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str124']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="answer" type=text><?=$lang['tpl.str122']?></td>
	</tr><tr>
	<td width=20% class=forumrow><?=$lang['tpl.str126']?></td>
	<td width=80% class=forumrow colspan=5>
	<?=$lang['tpl.str127']?> <input type="radio" value="0" <?=$sexChecked0?> name="sex">&nbsp;
	<?=$lang['tpl.str128']?> <input type="radio" value="1" <?=$sexChecked1?> name="sex">&nbsp;
	</td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str129']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="userphoto" type=text value="<?=$encUserPhoto?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow>Email</td>
	<td width=80% class=forumrow colspan=5><input size=45 name="useremail" type=text value="<?=$encUserEmail?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str130']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="homepage" type=text value="<?=$arrEncUserIM[0]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str131']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="face" type=text value="<?=$encUserFace?>"><?=$lang['tpl.str132']?><input size=3 name="width" type=text value="<?=$dbUserInfo['userwidth']?>"><?=$lang['tpl.str133']?><input size=3 name="height" type=text value="<?=$dbUserInfo['userheight']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow>OICQ</td>
	<td width=80% class=forumrow colspan=5><input size=45 name="oicq" type=text value="<?=$arrEncUserIM[1]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow>ICQ</td>
	<td width=80% class=forumrow colspan=5><input size=45 name="icq" type=text value="<?=$arrEncUserIM[2]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow>MSN</td>
	<td width=80% class=forumrow colspan=5><input size=45 name="msn" type=text value="<?=$arrEncUserIM[3]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow>AIM</td>
	<td width=80% class=forumrow colspan=5><input size=45 name="aim" type=text value="<?=$arrEncUserIM[4]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow>YaHoo</td>
	<td width=80% class=forumrow colspan=5><input size=45 name="yahoo" type=text value="<?=$arrEncUserIM[5]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow>UC</td>
	<td width=80% class=forumrow colspan=5><input size=45 name="uc" type=text value="<?=$arrEncUserIM[6]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str134']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="usertitle" type=text value="<?=$encUserTitle?>"></td>
	</tr>
	<tr><td class="tit1" colspan=6 height=23 align=left><?=$lang['tpl.str135']?></td></tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str136']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="article" type=text value="<?=$dbUserInfo['userpost']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str137']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="userdel" type=text value="<?=$dbUserInfo['userdel']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str138']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="userisbest" type=text value="<?=$dbUserInfo['userisbest']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str139']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="usermoney" type=text value="<?=$dbUserInfo['usermoney']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str140']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="userticket" type=text value="<?=$dbUserInfo['userticket']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str141']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="userwealth" type=text value="<?=$dbUserInfo['userwealth']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str142']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="userep" type=text value="<?=$dbUserInfo['userep']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str143']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="usercp" type=text value="<?=$dbUserInfo['usercp']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str144']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="userpower" type=text value="<?=$dbUserInfo['userpower']?>"></td>
	</tr>
	<tr><td class="tit1" colspan=6 height=23 align=left><?=$lang['tpl.str145']?></td></tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str146']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="birthday" type=text value="<?=$userbirthday?>"><?=$lang['tpl.str147']?></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str148']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="adddate" type=text value="<?=$dbUserInfo['joindate']?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str149']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="lastlogin" type=text value="<?=$lastlogintime?>"></td>
	</tr>
	<tr><td class="tit1" colspan=6 height=23 align=left><?=$lang['tpl.str150']?></td></tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str151']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="realname" type=text value="<?=$arrUserInfo[0]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str152']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="country" type=text value="<?=$arrUserInfo[3]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str153']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="userphone" type=text value="<?=$arrUserInfo[13]?>"></td>
	</tr><tr>
	<td width=20% class=forumrow><?=$lang['tpl.str154']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="address" type=text value="<?=$arrUserInfo[14]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str155']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="province" type=text value="<?=$arrUserInfo[4]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str156']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="city" type=text value="<?=$arrUserInfo[5]?>"></td>
	</tr><tr>
	<td width=20% class=forumrow><?=$lang['tpl.str157']?></td>
	<td width=80% class=forumrow colspan=5>
	<select size=1 name="shengxiao">
<?
	unset($arrShengXiao);
	$arrShengXiao["{$arrUserInfo[6]}"] = ' selected ';
	?>
	<option value=""></option>
	<option value="<?=$lang['tpl.str158']?>" <?=$arrShengXiao[$lang['tpl.str158']]?>><?=$lang['tpl.str158']?></option>
	<option value="<?=$lang['tpl.str159']?>" <?=$arrShengXiao[$lang['tpl.str159']]?>><?=$lang['tpl.str159']?></option>
	<option value="<?=$lang['tpl.str160']?>" <?=$arrShengXiao[$lang['tpl.str160']]?>><?=$lang['tpl.str160']?></option>
	<option value="<?=$lang['tpl.str161']?>" <?=$arrShengXiao[$lang['tpl.str161']]?>><?=$lang['tpl.str161']?></option>
	<option value="<?=$lang['tpl.str162']?>" <?=$arrShengXiao[$lang['tpl.str162']]?>><?=$lang['tpl.str162']?></option>
	<option value="<?=$lang['tpl.str163']?>" <?=$arrShengXiao[$lang['tpl.str163']]?>><?=$lang['tpl.str163']?></option>
	<option value="<?=$lang['tpl.str164']?>" <?=$arrShengXiao[$lang['tpl.str164']]?>><?=$lang['tpl.str164']?></option>
	<option value="<?=$lang['tpl.str165']?>" <?=$arrShengXiao[$lang['tpl.str165']]?>><?=$lang['tpl.str165']?></option>
	<option value="<?=$lang['tpl.str166']?>" <?=$arrShengXiao[$lang['tpl.str166']]?>><?=$lang['tpl.str166']?></option>
	<option value="<?=$lang['tpl.str167']?>" <?=$arrShengXiao[$lang['tpl.str167']]?>><?=$lang['tpl.str167']?></option>
	<option value="<?=$lang['tpl.str168']?>" <?=$arrShengXiao[$lang['tpl.str168']]?>><?=$lang['tpl.str168']?></option>
	<option value="<?=$lang['tpl.str169']?>" <?=$arrShengXiao[$lang['tpl.str169']]?>><?=$lang['tpl.str169']?></option>
	</select>
	</td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str170']?></td>
	<td width=80% class=forumrow colspan=5>
	<select size=1 name="blood">
<?
	unset($arrBlood);
	$arrBlood["{$arrUserInfo[7]}"] = ' selected ';
	?>
	<option value=""></option>
	<option value="A" <?=$arrBlood['A']?>>A</option>
	<option value="B" <?=$arrBlood['B']?>>B</option>
	<option value="AB" <?=$arrBlood['AB']?>>AB</option>
	<option value="O" <?=$arrBlood['O']?>>O</option>
	<option value="<?=$lang['tpl.str171']?>" <?=$arrBlood[$lang['tpl.str171']]?>><?=$lang['tpl.str171']?></option>
	</select>
	</td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str172']?></td>
	<td width=80% class=forumrow colspan=5>
	<select size=1 name="belief">
<?
	unset($arrBelief);
	$arrBelief["{$arrUserInfo[8]}"] = ' selected ';
	?>
	<option value=""></option>
	<option value="<?=$lang['tpl.str173']?>" <?=$arrBelief[$lang['tpl.str97']]?>><?=$lang['tpl.str173']?></option>
	<option value="<?=$lang['tpl.str174']?>" <?=$arrBelief[$lang['tpl.str174']]?>><?=$lang['tpl.str174']?></option>
	<option value="<?=$lang['tpl.str175']?>" <?=$arrBelief[$lang['tpl.str175']]?>><?=$lang['tpl.str175']?></option>
	<option value="<?=$lang['tpl.str176']?>" <?=$arrBelief[$lang['tpl.str176']]?>><?=$lang['tpl.str176']?></option>
	<option value="<?=$lang['tpl.str177']?>" <?=$arrBelief[$lang['tpl.str177']]?>><?=$lang['tpl.str177']?></option>
	<option value="<?=$lang['tpl.str178']?>" <?=$arrBelief[$lang['tpl.str178']]?>><?=$lang['tpl.str178']?></option>
	<option value="<?=$lang['tpl.str179']?>" <?=$arrBelief[$lang['tpl.str179']]?>><?=$lang['tpl.str179']?></option>
	<option value="<?=$lang['tpl.str180']?>" <?=$arrBelief[$lang['tpl.str180']]?>><?=$lang['tpl.str180']?></option>
	</select>
	</td>
	</tr><tr>
	<td width=20% class=forumrow><?=$lang['tpl.str181']?></td>
	<td width=80% class=forumrow colspan=5>
	<select name="occupation">
<?
	unset($arrOccupation);
	$arrOccupation["{$arrUserInfo[9]}"] = ' selected ';
	?>
	<option value=""> </option>
	<option value="<?=$lang['tpl.str182']?>" <?=$arrOccupation[$lang['tpl.str182']]?>><?=$lang['tpl.str182']?></option>
	<option value="<?=$lang['tpl.str183']?>" <?=$arrOccupation[$lang['tpl.str183']]?>><?=$lang['tpl.str183']?></option>
	<option value="<?=$lang['tpl.str184']?>" <?=$arrOccupation[$lang['tpl.str184']]?>><?=$lang['tpl.str184']?></option>
	<option value="<?=$lang['tpl.str185']?>" <?=$arrOccupation[$lang['tpl.str185']]?>><?=$lang['tpl.str185']?></option>
	<option value="<?=$lang['tpl.str186']?>" <?=$arrOccupation[$lang['tpl.str186']]?>><?=$lang['tpl.str186']?></option>
	<option value="<?=$lang['tpl.str187']?>" <?=$arrOccupation[$lang['tpl.str187']]?>><?=$lang['tpl.str187']?></option>
	<option value="<?=$lang['tpl.str188']?>" <?=$arrOccupation[$lang['tpl.str188']]?>><?=$lang['tpl.str188']?></option>
	<option value="<?=$lang['tpl.str189']?>" <?=$arrOccupation[$lang['tpl.str189']]?>><?=$lang['tpl.str189']?></option>
	<option value="<?=$lang['tpl.str190']?>" <?=$arrOccupation[$lang['tpl.str190']]?>><?=$lang['tpl.str190']?></option>
	<option value="<?=$lang['tpl.str191']?>" <?=$arrOccupation[$lang['tpl.str191']]?>><?=$lang['tpl.str191']?></option>
	<option value="<?=$lang['tpl.str192']?>" <?=$arrOccupation[$lang['tpl.str192']]?>><?=$lang['tpl.str192']?></option>
	<option value="<?=$lang['tpl.str193']?>" <?=$arrOccupation[$lang['tpl.str193']]?>><?=$lang['tpl.str193']?></option>
	<option value="<?=$lang['tpl.str194']?>" <?=$arrOccupation[$lang['tpl.str194']]?>><?=$lang['tpl.str194']?></option>
	<option value="<?=$lang['tpl.str195']?>" <?=$arrOccupation[$lang['tpl.str195']]?>><?=$lang['tpl.str195']?></option>
	<option value="<?=$lang['tpl.str196']?>" <?=$arrOccupation[$lang['tpl.str196']]?>><?=$lang['tpl.str196']?></option>
	<option value="<?=$lang['tpl.str197']?>" <?=$arrOccupation[$lang['tpl.str197']]?>><?=$lang['tpl.str197']?></option>
	<option value="<?=$lang['tpl.str198']?>" <?=$arrOccupation[$lang['tpl.str198']]?>><?=$lang['tpl.str198']?></option>
	<option value="<?=$lang['tpl.str199']?>" <?=$arrOccupation[$lang['tpl.str199']]?>><?=$lang['tpl.str199']?></option>
	<option value="<?=$lang['tpl.str200']?>" <?=$arrOccupation[$lang['tpl.str200']]?>><?=$lang['tpl.str200']?></option>
	<option value="<?=$lang['tpl.str201']?>" <?=$arrOccupation[$lang['tpl.str201']]?>><?=$lang['tpl.str201']?></option>
	</select>
	</td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str202']?></td>
	<td width=80% class=forumrow colspan=5>
	<select size=1 name="marital">
<?
	unset($arrMarital);
	$arrMarital["{$arrUserInfo[10]}"] = ' selected ';
	?>
	<option value=""></option>
	<option value="<?=$lang['tpl.str203']?>" <?=$arrMarital[$lang['tpl.str203']]?>><?=$lang['tpl.str203']?></option>
	<option value="<?=$lang['tpl.str204']?>" <?=$arrMarital[$lang['tpl.str204']]?>><?=$lang['tpl.str204']?></option>
	<option value="<?=$lang['tpl.str205']?>" <?=$arrMarital[$lang['tpl.str205']]?>><?=$lang['tpl.str205']?></option>
	<option value="<?=$lang['tpl.str206']?>" <?=$arrMarital[$lang['tpl.str206']]?>><?=$lang['tpl.str206']?></option>
	</select>
	</td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str207']?></td>
	<td width=80% class=forumrow colspan=5>
	<select size=1 name="education">
<?
	unset($arrEducation);
	$arrEducation["{$arrUserInfo[11]}"] = ' selected ';
	?>
	<option value=""></option>
	<option value="<?=$lang['tpl.str208']?>" <?=$arrEducation[$lang['tpl.str208']]?>><?=$lang['tpl.str208']?></option>
	<option value="<?=$lang['tpl.str209']?>" <?=$arrEducation[$lang['tpl.str209']]?>><?=$lang['tpl.str209']?></option>
	<option value="<?=$lang['tpl.str210']?>" <?=$arrEducation[$lang['tpl.str210']]?>><?=$lang['tpl.str210']?></option>
	<option value="<?=$lang['tpl.str211']?>" <?=$arrEducation[$lang['tpl.str211']]?>><?=$lang['tpl.str211']?></option>
	<option value="<?=$lang['tpl.str212']?>" <?=$arrEducation[$lang['tpl.str212']]?>><?=$lang['tpl.str212']?></option>
	<option value="<?=$lang['tpl.str213']?>" <?=$arrEducation[$lang['tpl.str213']]?>><?=$lang['tpl.str213']?></option>
	</select>
	</td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str214']?></td>
	<td width=80% class=forumrow colspan=5><input size=45 name="college" type=text value="<?=$arrUserInfo[12]?>"></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str215']?></td>
	<td width=80% class=forumrow colspan=5>
	<textarea name=character rows=4 cols=80><?=$arrUserInfo[1]?></textarea>
	</td>
	</tr><tr>
	<td width=20% class=forumrow><?=$lang['tpl.str216']?></td>
	<td width=80% class=forumrow colspan=5>
	<textarea name=personal rows=4 cols=80><?=$arrUserInfo[2]?></textarea>
	</td>
	</tr><tr>
	<td width=20% class=forumrow><?=$lang['tpl.str217']?></td>
	<td width=80% class=forumrow colspan=5>
	<textarea name="sign" rows=4 cols=80><?=$encUserSign?></textarea>
	</td>
	</tr>
	<tr><td class="tit1" colspan=6 height=23 align=left><?=$lang['tpl.str218']?></td></tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str219']?></td>
	<td width=80% class=forumrow colspan=5>
<?
	unset($arrRadio);
	$arrRadio["{$dbUserInfo['lockuser']}"] = ' checked ';
?>
	<?=$lang['tpl.str220']?> <input type="radio" value="0" <?=$arrRadio['0']?> name="lockuser">&nbsp;
	<?=$lang['tpl.str221']?> <input type="radio" value="1" <?=$arrRadio['1']?> name="lockuser">&nbsp;
	<?=$lang['tpl.str222']?> <input type="radio" value="2" <?=$arrRadio['2']?> name="lockuser">
	</td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str223']?></td>
	<td width=80% class=forumrow colspan=5>
<?
	unset($arrRadio);
	$arrRadio["{$dbUserInfo['ischallenge']}"] = ' checked ';
	if( $arrRadio['0'] === ' checked ' ){
		$disabledMobile = ' disabled ';
	} else{
		$disabledMobile = '';
	}
	if ($dbUserInfo['vip_startime'] > 0) {
		$dbUserInfo['vip_startime'] = gmdate('Y-m-d H:i:s', $dbUserInfo['vip_startime']+getUserTimeZoneOffset());
	}
	if ($dbUserInfo['vip_endtime'] > 0) {
		$dbUserInfo['vip_endtime'] = gmdate('Y-m-d H:i:s', $dbUserInfo['vip_endtime']+getUserTimeZoneOffset());
	}
?>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function IsChallengeOnClick(radio){
		if( radio.value === '0' ){
			radio.form.usermobile.disabled = true;
		} else{
			radio.form.usermobile.disabled = false;
		}
	}
	//-->
	</SCRIPT>
	<?=$lang['tpl.str224']?> <input type="radio" value="0" <?=$arrRadio['0']?> name="ischallenge" onclick="IsChallengeOnClick(this)">&nbsp;
	<?=$lang['tpl.str225']?> <input type="radio" value="1" <?=$arrRadio['1']?> name="ischallenge">&nbsp;
	&nbsp;&nbsp;
	<?=$lang['tpl.str226']?><input type=text size=15 name="usermobile" Value="<?=$dbUserInfo['usermobile']?>" <?=$disabledMobile?>
	</td>
	</tr>

	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str227']?></td>
	<td width=80% class=forumrow colspan=5>
	<INPUT TYPE="text" NAME="vip_startime" value="<?=$dbUserInfo['vip_startime']?>">
	</td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str228']?></td>
	<td width=80% class=forumrow colspan=5>
	<INPUT TYPE="text" NAME="vip_endtime" value="<?=$dbUserInfo['vip_endtime']?>">
	</td>
	</tr>
	<tr>
	<td width=100% class=forumrow align=center colspan=6 style="text-align:center;"><input name="submit" class="button" type=submit value="   <?=$lang['tpl.str229']?>   "></td>
	</tr>
	</FORM>
<?
} elseif( $doaction === 'save_user_info' ){
	if( !is_numeric($userid) || $userid <= 0 ){
		printFooter();
		return show_msg($lang['tpl.str230'],$lang['tpl.str235']);
	}
	//用户签名长度限制
	if( Dv_StrLength($sign) > 250 ){
		printFooter();
		return show_msg($lang['tpl.str230'],$lang['tpl.str231']);
	}
	$tmpRs1 =& $db->getResultSet("SELECT usertitle,grouppic FROM {$dv}usergroups WHERE usergroupid='{$user_groups}'");
	if( $tmpRs1 === false ){
		printFooter();
		return show_msg($lang['tpl.str230'],$lang['tpl.str232']);
	}
	$count =& $db->scalar("SELECT COUNT(1) FROM {$dv}user WHERE userid='{$userid}'");
	if( $count <= 0 ){
		printFooter();
		return show_msg($lang['tpl.str230'],$lang['tpl.str233']);
	}
	$iUserClass = $tmpRs1[0]['usertitle'];
	$iTitlePic = $tmpRs1[0]['grouppic'];
	unset($tmpRs1);
	$userinfo = "{$realname}|||{$character}|||{$personal}|||{$country}|||{$province}|||{$city}|||{$shengxiao}|||{$blood}|||{$belief}|||{$occupation}|||{$marital}|||{$education}|||{$college}|||{$userphone}|||{$address}";
	$myuserim = "{$homepage}|||{$oicq}|||{$icq}|||{$msn}|||{$aim}|||{$yahoo}|||{$uc}";
	if ( $password != '' ){
		$password = ",userpassword='".dv_md5($password)."'";
	}

	$adddate = is_numeric($adddate) ? $adddate : ((false !== ($timestamp = dv_gmtimestamp($adddate))) ? $timestamp-getUserTimeZoneOffset() : 'joindate');
	$birthday = is_numeric($birthday) ? $birthday : ((false !== ($timestamp = dv_gmtimestamp($birthday))) ? $timestamp-getUserTimeZoneOffset() : 'userbirthday');
	$lastlogin = is_numeric($lastlogin) ? $lastlogin : ((false !== ($timestamp = dv_gmtimestamp($lastlogin))) ? $timestamp-getUserTimeZoneOffset() : 'lastlogin');
	$vip_startime = is_numeric($vip_startime) ? $vip_startime : ((false !== ($timestamp = dv_gmtimestamp($vip_startime))) ? $timestamp-getUserTimeZoneOffset() : 'vip_startime');
	$vip_endtime = is_numeric($vip_endtime) ? $vip_endtime : ((false !== ($timestamp = dv_gmtimestamp($vip_endtime))) ? $timestamp-getUserTimeZoneOffset() : 'vip_endtime');
	$db->query("UPDATE {$dv}user SET userphoto='{$userphoto}',username='{$username}'{$password},usergroupid='{$user_groups}',userquesion='{$quesion}',useranswer='".($answer!=''?dv_md5($answer):"useranswer")."',userclass='{$iUserClass}',useremail='{$useremail}',usersex='{$sex}',userim='{$myuserim}',userface='{$face}',userwidth='".(is_numeric($width)?$width:"userwidth")."',userheight='".(is_numeric($height)?$height:"userheight")."',usertitle='{$usertitle}',titlepic='{$iTitlePic}',userpost=".(is_numeric($article)?$article:"userpost").",userdel=".(is_numeric($userdel)?$userdel:"userdel").",userisbest=".(is_numeric($userisbest)?$userisbest:"userisbest").",userpower=".(is_numeric($userpower)?$userpower:"userpower").",userwealth=".(is_numeric($userwealth)?$userwealth:"userwealth").",usermoney=".(is_numeric($usermoney)?$usermoney:"usermoney").",userticket=".(is_numeric($userticket)?$userticket:"userticket").",userep=".(is_numeric($userep)?$userep:"userep").",usercp=".(is_numeric($usercp)?$usercp:"usercp").",lockuser=".(is_numeric($lockuser)?$lockuser:"lockuser").",userbirthday={$birthday},joindate={$adddate},lastlogin={$lastlogin},vip_startime={$vip_startime},vip_endtime={$vip_endtime},usersign='{$sign}',userinfo='{$userinfo}',ischallenge=".($ischallenge==0||$usermobile==''?0:"1").",usermobile=".($ischallenge==0||$usermobile==''?"''":"'{$usermobile}'")." WHERE userid='{$userid}'");
	?>
<tr><td colspan="14" height="23" style="text-align:left;" class="tit1"><?=$lang['tpl.str234']?></td></tr>
<?
	printFooter();
	return show_msg($lang['tpl.str234'],$lang['tpl.str236'],1);
} elseif( $doaction === 'user_permission' ){
	$lang['tpl.str237'] = str_replace('{$username}',$username,$lang['tpl.str237']);
	?>
<tr><td colspan="14" height="23" style="text-align:left;" class="tdtit"><?=$lang['tpl.str237']?></td></tr>
<?
	if( !is_numeric($userid) ){
		printFooter();
		return show_msg($lang['tpl.str238'],$lang['tpl.str239']);
	}
	?>
<tr><td colspan="14" class="forumrow" height="25"><?=$lang['tpl.str240']?></td></tr>
<?
	$ucUserID = $db->scalar("SELECT uc_userid FROM {$dv}useraccess WHERE uc_boardid=0 AND uc_userid='{$userid}'");
	if( $ucUserID <= 0 ){
		?>
<tr><td colspan="14" class="forumrow" height="25"><a href="?doaction=user_board_permission&boardid=0&userid=<?=$userid?>"><?=$lang['tpl.str241']?></a><?=$lang['tpl.str242']?></td></tr>
<?
	} else{
?>
<tr><td colspan="14" class="forumrow" height="25"><a href="?doaction=user_board_permission&boardid=0&userid=<?=$userid?>"><font color=red><?=$lang['tpl.str241']?></font></a><?=$lang['tpl.str242']?></tr>
<?
	}
	?>
<tr><td colspan="14" class="forumrow" style="text-align:left;"><B><?=$lang['tpl.str243']?></B><BR>
<?
	$boards =& $db->getResultSet("SELECT DISTINCT b.depth,b.child,b.boardid,b.parentid,b.boardtype,ua.uc_userid FROM {$dv}board b LEFT JOIN {$dv}useraccess ua ON ua.uc_boardid=b.boardid AND ua.uc_userid='{$userid}' ORDER BY rootid,orders");
	if( $boards !== false ){
		foreach( $boards as $currResult ){
			$currHtml = '';
			if( $currResult['depth'] > 0 ){
				$currHtml = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;',$currResult['depth']);
			}
			if( $currResult['child'] > 0 ){
				$currHtml .= '<img src="../templates/default/images/nofollow.gif" border="0">';
			}
			if( $currResult['uc_userid'] > 0 ){
				$strTmpLeft = '<font color="red"><b>'.$lang['tpl.str144'];
				$strTmpRight = '('.$currResult['child'].')</b></font>';
			} else{
				$strTmpLeft = '';
				$strTmpRight = '';
			}
			?>
<?=$currHtml?>
<a href="?doaction=user_board_permission&boardid=<?=$currResult['boardid']?>&userid=<?=$userid?>"><?=$strTmpLeft?><?=$currResult['boardtype']?><?=$strTmpRight?></a><br>
<?
		}
	}
	?>
</td></tr>
<?
} elseif( $doaction === 'user_board_permission' ){
	if( $userid <= 0 ){
		printFooter();
		return show_msg($lang['tpl.str245'],$lang['tpl.str246']);
	}
	if( !is_numeric($boardid) ){
		printFooter();
		return show_msg($lang['tpl.str245'],$lang['tpl.str247']);
	}
	$tmpRs =& $db->getResultSet("SELECT u.usergroupid,ug.title,u.username FROM {$dv}user u INNER JOIN {$dv}usergroups ug ON u.usergroupid=ug.usergroupid WHERE u.userid='{$userid}'");
	if( $tmpRs === false ){
		printFooter();
		return show_msg($lang['tpl.str245'],$lang['tpl.str248']);
	}
	$groupID = $tmpRs[0]['usergroupid'];
	$userTitle = $tmpRs[0]['title'];
	$memberName = $tmpRs[0]['username'];
	unset($tmpRs);
	if( $boardid <= 0 ){
		$boardType = $lang['tpl.str249'];
	} else{
		$strTmp = $db->scalar("SELECT boardtype FROM {$dv}board WHERE boardid='{$boardid}'");
		if( $strTmp ){
			$boardType = $strTmp;
		}
	}
	$FoundGroup = false;
	$FoundUserPermission = false;
	$FoundGroupPermission = false;
	$reGroupSetting = $db->scalar("SELECT uc_setting FROM {$dv}useraccess WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
	if( $reGroupSetting !== false ){
		$FoundGroup = true;
		$FoundUserPermission = true;
	}
	if( $FoundGroup === false ){
		$reGroupSetting = $db->scalar("SELECT psetting FROM {$dv}boardpermission WHERE boardid='{$boardid}' AND groupid='{$groupID}'");
		if( $reGroupSetting !== false ){
			$FoundGroup = true;
			$FoundGroupPermission = true;
		}
	}
	if( $FoundGroup === false ){
		$reGroupSetting = $db->scalar("SELECT groupsetting FROM {$dv}usergroups WHERE usergroupid='{$groupID}'");
		if( $reGroupSetting !== false ){
			$FoundGroup = true;
			$FoundGroupPermission = true;
		} else{
			printFooter();
			return show_msg($lang['tpl.str245'],$lang['tpl.str250']);
		}
	}
	$lang['tpl.str251'] = str_replace(array('{$memberName}','{$boardType}'),array($memberName,$boardType),$lang['tpl.str251']);
	$lang['tpl.str252'] = str_replace(array('{$boardType}', '{$userTitle}'),array($boardType, $userTitle),$lang['tpl.str252']);
	?>
<tr><td colspan="14" height="23" align="left" class="tdtit"><?=$lang['tpl.str251']?></td></tr>
<tr><td colspan="14" height="25" class="forumrow"><?=$lang['tpl.str252']?></td></tr>
<tr><td colspan="14" class="forumrow">
<table width="100%" border="0" cellspacing="1" cellpadding="0"  align=center>
<FORM METHOD="POST" ACTION="?doaction=save_user_permission">
<input type="hidden" name="userid" value="<?=$userid?>">
<input type="hidden" name="boardid" value="<?=$boardid?>">
<input type="hidden" name="username" value="<?=$memberName?>">
<?
	if( $boardid != 0 ){
		?>
<tr>
<td width="100%" class=Forumrow colspan=2 height=25>
<?=$lang['tpl.str253']?>
</td>
</tr>
<tr>
<td width="100%" class=Forumrow colspan=2 height=25>
<?=$lang['tpl.str254']?>
</td>
</tr>
<?
	} else{
		?>
<input type="hidden" name="savetype" value="0">
<?
	}
	$strIsDefaultChecked1 = ($FoundGroupPermission===true?' checked ':'');
	$strIsDefaultChecked0 = ($FoundUserPermission===true?' checked ':'');
	?>
<tr>
<td height="23" colspan="2" class=forumrow><input type=radio name="isdefault" value="1" <?=$strIsDefaultChecked1?><?=$lang['tpl.str255']?></td>
</tr>
<tr>
<td height="23" colspan="2"  class=forumrow><input type=radio name="isdefault" value="0" <?=$strIsDefaultChecked0?>><?=$lang['tpl.str256']?></td>
</tr>
<?
	echo grouppermission($reGroupSetting);
?>
<input type="hidden" value="yes" name="groupaction">
</FORM>
</table>
</td></tr>
<?
} elseif( $doaction === 'save_user_permission' ){
	if( $userid <= 0 ){
		printFooter();
		return show_msg($lang['tpl.str245'],$lang['tpl.str246']);
	}
	if( !is_numeric($boardid) ){
		printFooter();
		return show_msg($lang['tpl.str245'],$lang['tpl.str246']);
	}
	$lang['tpl.str257'] = str_replace(array('{$savetype}','{$username}'),array($savetype,$username),$lang['tpl.str257']);
	?>
<tr><td colspan=8 height=23 align=left class="tit1"><?=$lang['tpl.str257']?></td></tr>
<?
	switch(intval($savetype)){
		case 0://当前版面
			if( $isdefault == 1 ){
				$db->query("DELETE FROM {$dv}useraccess WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
				$FoundSetting = $db->scalar("SELECT COUNT(1) FROM {$dv}useraccess WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
				if( $boardid > 0 ){
					if( $FoundSetting == 0 ){
						$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',',') WHERE boardid='{$boardid}'");
					} else{
						$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(',,',',') WHERE boardid='{$boardid}'");
					}
				}
			} else{
				$groupPermission = $db->escape_string(getgrouppermission());
				$count = $db->scalar("SELECT COUNT(1) FROM {$dv}useraccess WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
				if( $count <= 0 ){
					$db->query("INSERT INTO {$dv}useraccess(uc_userid,uc_boardid,uc_setting) VALUES('{$userid}','{$boardid}','{$groupPermission}')");
				} else{
					$db->query("UPDATE {$dv}useraccess SET uc_setting='{$groupPermission}' WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
				}
				if( $boardid > 0 ){
					$db->query("UPDATE {$dv}board SET isgroupsetting=CONCAT(REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',','),'0_{$userid},') WHERE boardid='{$boardid}'");
				}
			}
			break;
		case 1://所有版面
			$boardIDList = false;
			$db->query("SET @BoardIDList:=NULL;");
			if( $query = $db->query("SELECT @BoardIDList:=COALESCE(CONCAT(@BoardIDList,',',boardid),boardid) AS BoardIDList FROM {$dv}board") ){
				$numRows = $db->num_rows($query);
				if( $numRows > 0 ){
					if( $numRows > 1 ){
						$db->data_seek($query,$numRows-1);
					}
					$tmp = $db->fetch_row($query);
					if( $tmp !== false ){
						$boardIDList = $tmp[0];
					}
				}
			}
			if( $boardIDList !== false && checkIDList($boardIDList) !== false ){
				if( $isdefault == 1 ){
					$db->query("DELETE FROM {$dv}useraccess WHERE uc_boardid IN({$boardIDList}) AND uc_userid='{$userid}'");
					$arrTmp = explode(',',$boardIDList);
					foreach( $arrTmp as $currBoardID ){
						$FoundSetting = $db->scalar("SELECT COUINT(1) FROM {$dv}useraccess WHERE uc_boardid='{$currBoardID}' AND uc_userid='{$userid}'");
						if( $FoundSetting == 0 ){
							$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',',') WHERE boardid='{$currBoardID}'");
						} else{
							$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(',,',',') WHERE boardid='{$currBoardID}'");
						}
					}
				} else{
					$arrTmp = explode(',',$boardIDList);
					$groupPermission = $db->escape_string(getgrouppermission());
					foreach( $arrTmp as $currBoardID ){
						$count = $db->scalar("SELECT COUNT(1) FROM {$dv}useraccess WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
						if( $count <= 0 ){
							$db->query("INSERT INTO {$dv}useraccess(uc_userid,uc_boardid,uc_setting) VALUES('{$userid}','{$currBoardID}','{$groupPermission}')");
						} else{
							$db->query("UPDATE {$dv}useraccess SET uc_setting='{$groupPermission}' WHERE uc_boardid='{$currBoardID}' AND uc_userid='{$userid}'");
						}
						if( $currBoardID > 0 ){
							$db->query("UPDATE {$dv}board SET isgroupsetting=CONCAT(REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',','),'0_{$userid},') WHERE boardid='{$currBoardID}'");
						}
					}
				}
			}
			break;
		case 2://相同分类下所有版面（不包括分类）
			$boardRootID = $db->scalar("SELECT rootid FROM {$dv}board WHERE boardid='{$boardid}'");
			$boardIDList = false;
			$db->query("SET @BoardIDList:=NULL;");
			if( $query = $db->query("SELECT @BoardIDList:=COALESCE(CONCAT(@BoardIDList,',',boardid),boardid) AS BoardIDList FROM {$dv}board WHERE parentid<>0 AND rootid='{$boardRootID}'") ){
				$numRows = $db->num_rows($query);
				if( $numRows > 0 ){
					if( $numRows > 1 ){
						$db->data_seek($query,$numRows-1);
					}
					$tmp = $db->fetch_row($query);
					if( $tmp !== false ){
						$boardIDList = $tmp[0];
					}
				}
			}
			if( $boardIDList !== false && checkIDList($boardIDList) !== false ){
				if( $isdefault == 1 ){
					$db->query("DELETE FROM {$dv}useraccess WHERE uc_boardid IN({$boardIDList}) AND uc_userid='{$userid}'");
					$arrTmp = explode(',',$boardIDList);
					foreach( $arrTmp as $currBoardID ){
						$FoundSetting = $db->scalar("SELECT COUINT(1) FROM {$dv}useraccess WHERE uc_boardid='{$currBoardID}' AND uc_userid='{$userid}'");
						if( $FoundSetting == 0 ){
							$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',',') WHERE boardid='{$currBoardID}'");
						} else{
							$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(',,',',') WHERE boardid='{$currBoardID}'");
						}
					}
				} else{
					$arrTmp = explode(',',$boardIDList);
					$groupPermission = $db->escape_string(getgrouppermission());
					foreach( $arrTmp as $currBoardID ){
						$count = $db->scalar("SELECT COUNT(1) FROM {$dv}useraccess WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
						if( $count <= 0 ){
							$db->query("INSERT INTO {$dv}useraccess(uc_userid,uc_boardid,uc_setting) VALUES('{$userid}','{$currBoardID}','{$groupPermission}')");
						} else{
							$db->query("UPDATE {$dv}useraccess SET uc_setting='{$groupPermission}' WHERE uc_boardid='{$currBoardID}' AND uc_userid='{$userid}'");
						}
						if( $currBoardID > 0 ){
							$db->query("UPDATE {$dv}board SET isgroupsetting=CONCAT(REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',','),'0_{$userid},') WHERE boardid='{$currBoardID}'");
						}
					}
				}
			}
			break;
		case 3://相同分类下所有版面（包括分类）
			$boardRootID = $db->scalar("SELECT rootid FROM {$dv}board WHERE boardid='{$boardid}'");
			$boardIDList = false;
			$db->query("SET @BoardIDList:=NULL;");
			if( $query = $db->query("SELECT @BoardIDList:=COALESCE(CONCAT(@BoardIDList,',',boardid),boardid) AS BoardIDList FROM {$dv}board WHERE rootid='{$boardRootID}'") ){
				$numRows = $db->num_rows($query);
				if( $numRows > 0 ){
					if( $numRows > 1 ){
						$db->data_seek($query,$numRows-1);
					}
					$tmp = $db->fetch_row($query);
					if( $tmp !== false ){
						$boardIDList = $tmp[0];
					}
				}
			}
			if( $boardIDList !== false && checkIDList($boardIDList) !== false ){
				if( $isdefault == 1 ){
					$db->query("DELETE FROM {$dv}useraccess WHERE uc_boardid IN({$boardIDList}) AND uc_userid='{$userid}'");
					$arrTmp = explode(',',$boardIDList);
					foreach( $arrTmp as $currBoardID ){
						$FoundSetting = $db->scalar("SELECT COUINT(1) FROM {$dv}useraccess WHERE uc_boardid='{$currBoardID}' AND uc_userid='{$userid}'");
						if( $FoundSetting == 0 ){
							$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',',') WHERE boardid='{$currBoardID}'");
						} else{
							$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(',,',',') WHERE boardid='{$currBoardID}'");
						}
					}
				} else{
					$arrTmp = explode(',',$boardIDList);
					$groupPermission = $db->escape_string(getgrouppermission());
					foreach( $arrTmp as $currBoardID ){
						$count = $db->scalar("SELECT COUNT(1) FROM {$dv}useraccess WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
						if( $count <= 0 ){
							$db->query("INSERT INTO {$dv}useraccess(uc_userid,uc_boardid,uc_setting) VALUES('{$userid}','{$currBoardID}','{$groupPermission}')");
						} else{
							$db->query("UPDATE {$dv}useraccess SET uc_setting='{$groupPermission}' WHERE uc_boardid='{$currBoardID}' AND uc_userid='{$userid}'");
						}
						if( $currBoardID > 0 ){
							$db->query("UPDATE {$dv}board SET isgroupsetting=CONCAT(REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',','),'0_{$userid},') WHERE boardid='{$currBoardID}'");
						}
					}
				}
			}
			break;
		case 4://同分类同级别版面
			$tmpRs =& $db->getResultSet("SELECT rootid,parentstr,parentid FROM {$dv}board WHERE boardid='{$boardid}'");
			$boardRootID = $tmpRs[0]['rootid'];
			$boardParentID = $tmpRs[0]['parentid'];
			$boardParentStr = $tmpRs[0]['parentstr'];
			$boardIDList = false;
			$db->query("SET @BoardIDList:=NULL;");
			if( $query = $db->query("SELECT @BoardIDList:=COALESCE(CONCAT(@BoardIDList,',',boardid),boardid) AS BoardIDList FROM {$dv}board WHERE rootid='{$boardRootID}' AND parentid='{$boardParentID}' AND parentstr='{$boardParentStr}'") ){
				$numRows = $db->num_rows($query);
				if( $numRows > 0 ){
					if( $numRows > 1 ){
						$db->data_seek($query,$numRows-1);
					}
					$tmp = $db->fetch_row($query);
					if( $tmp !== false ){
						$boardIDList = $tmp[0];
					}
				}
			}
			if( $boardIDList !== false && checkIDList($boardIDList) !== false ){
				if( $isdefault == 1 ){
					$db->query("DELETE FROM {$dv}useraccess WHERE uc_boardid IN({$boardIDList}) AND uc_userid='{$userid}'");
					$arrTmp = explode(',',$boardIDList);
					foreach( $arrTmp as $currBoardID ){
						$FoundSetting = $db->scalar("SELECT COUINT(1) FROM {$dv}useraccess WHERE uc_boardid='{$currBoardID}' AND uc_userid='{$userid}'");
						if( $FoundSetting == 0 ){
							$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',',') WHERE boardid='{$currBoardID}'");
						} else{
							$db->query("UPDATE {$dv}board SET isgroupsetting=REPLACE(',,',',') WHERE boardid='{$currBoardID}'");
						}
					}
				} else{
					$arrTmp = explode(',',$boardIDList);
					$groupPermission = $db->escape_string(getgrouppermission());
					foreach( $arrTmp as $currBoardID ){
						$count = $db->scalar("SELECT COUNT(1) FROM {$dv}useraccess WHERE uc_boardid='{$boardid}' AND uc_userid='{$userid}'");
						if( $count <= 0 ){
							$db->query("INSERT INTO {$dv}useraccess(uc_userid,uc_boardid,uc_setting) VALUES('{$userid}','{$currBoardID}','{$groupPermission}')");
						} else{
							$db->query("UPDATE {$dv}useraccess SET uc_setting='{$groupPermission}' WHERE uc_boardid='{$currBoardID}' AND uc_userid='{$userid}'");
						}
						if( $currBoardID > 0 ){
							$db->query("UPDATE {$dv}board SET isgroupsetting=CONCAT(REPLACE(REPLACE(isgroupsetting,',0_{$userid}',''),',,',','),'0_{$userid},') WHERE boardid='{$currBoardID}'");
						}
					}
				}
			}
			break;
	}
	include_once INC_PATH.'BoardCache.class.php';
	$mycache =& new BoardCache($db);
	$mycache->createuserpermission();
	?>
<tr><td colspan=8 class=forumrow><li><?=$lang['tpl.str258']?></li>
<?
	if( $_POST['GroupSetting(70)'] == 1 ){
		?>
<?=$lang['tpl.str259']?>
<?
	}
	?>
</td></tr>
<?
} elseif( $doaction === 'unite_user' ){
	$auser = trim($auser);
	$buser = trim($buser);
	if( $auser !== '' && $buser !== '' ){
		if( $buser === $auser ){
			printFooter();
			return show_msg($lang['tpl.str260'],$lang['tpl.str261']);
		}
		$tmpRs =& $db->getResultSet("SELECT userid,userpost,usertopic,userviews,userwealth,userep,usercp,userpower,userisbest,userdel,usergroupid FROM {$dv}user WHERE username='{$auser}'");
		if( $tmpRs === false ){
			printFooter();
			return show_msg($lang['tpl.str260'],$lang['tpl.str262']);
		}
		$dbUserInfo =& $tmpRs[0];
		$auserid = $dbUserInfo['userid'];
		unset($tmpRs);
		if( $dbUserInfo['usergroupid'] < 4 ){
			printFooter();
			return show_msg($lang['tpl.str260'],$lang['tpl.str263']);
		}
		$buserid = $db->scalar("SELECT userid FROM {$dv}user WHERE username='{$buser}'");
		if( $buserid === false || $buserid <= 0 ){
			printFooter();
			return show_msg($lang['tpl.str260'],$lang['tpl.str264']);
		}
		if( $touserid == $dbUserInfo['userid'] ){
			printFooter();
			return show_msg($lang['tpl.str260'],$lang['tpl.str261']);
		}
		//合并用户的资料
		$db->query("UPDATE {$dv}user SET userpost=userpost+{$dbUserInfo['userpost']},usertopic=usertopic+{$dbUserInfo['usertopic']},userviews=userviews+{$dbUserInfo['userviews']},userwealth=userwealth+{$dbUserInfo['userwealth']},userep=userep+{$dbUserInfo['userep']},usercp=usercp+{$dbUserInfo['usercp']},userpower=userpower+{$dbUserInfo['userpower']},userisbest=userisbest+{$dbUserInfo['userisbest']},userdel=userdel+{$dbUserInfo['userdel']} WHERE userid='{$buserid}'");
		$db->query("UPDATE {$dv}user SET userpost=0,usertopic=0,userviews=0,userwealth=0,userep=0,usercp=0,userpower=0,userisbest=0,userdel=0,usermsg='0||0||null' WHERE userid='{$auserid}'");
		//更新帖子数据
		$arrTable =& getAllPostTable();
		if( !empty($arrTable) ){
			foreach ( $arrTable as $currTbl ){
				$db->query("UPDATE ".$db->escape_string($currTbl['tablename'])." SET postuserid='{$buserid}',username='{$buser}' WHERE postuserid='{$auserid}'");
			}
		}
		//更新主题数据
		$db->query("UPDATE {$dv}topic SET postuserid='{$buserid}',postusername='{$buser}' WHERE postuserid='{$auserid}'");
		//更新短信数据
		$db->query("UPDATE {$dv}message SET incept='{$buser}' WHERE incept='{$auser}'");
		$db->query("UPDATE {$dv}message SET sender='{$buser}' WHERE sender='{$auser}'");
		$db->query("UPDATE {$dv}friend SET f_username='{$buser}' WHERE f_username='{$auser}'");
		$db->query("UPDATE {$dv}bookmark SET username='{$buser}' WHERE username='{$auser}'");
		$db->query("UPDATE {$dv}besttopic SET postuserid='{$buserid}',postusername='{$buser}' WHERE postuserid='{$auserid}'");
		//更新用户上传表
		$db->query("UPDATE {$dv}upfile SET f_userid='{$buserid}',f_username='{$buser}' WHERE f_userid='{$auserid}'");
		printFooter();
		return show_msg($lang['tpl.str260'],$lang['tpl.str272'],1);
	} else{
		?>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function CheckFormOnSubmit(form){
		if( form.auser.value === '' ){
			alert("{$lang['tpl.str265']}");
			form.auser.focus();
			return false;
		}
		if( form.buser.value === '' ){
			alert("{$lang['tpl.str266']}");
			form.buser.focus();
			return false;
		}
		return true;
	}
	//-->
	</SCRIPT>
	<form action="?doaction=unite_user" method=post onsubmit="return CheckFormOnSubmit(this)">
	<tr>
	<td align=left colspan=7 class="tdtit"><?=$lang['tpl.str267']?></td>
	</tr>
	<tr>
	<td width=20% class=forumrow><?=$lang['tpl.str268']?></td>
	<td width=80% class=forumrow colspan=5><?=$lang['tpl.str269']?></td>
	</tr>
	<tr>
	<td width=20% class=forumrow1><?=$lang['tpl.str270']?></td>
	<td width=80% class=forumrow1 colspan=5><?=$lang['tpl.str271']?></td>
	</tr>
	</form>
<?
	}
} else{
	show_msg($lang['Error.strings0']);
	return printFooter();
}
?>
<!--End Body Block-->

<!--Start Footer Block-->
</table>
<p></p>
<!--End Footer Block-->
<?
function printFooter(){
?>
<!--Start Footer Block-->
</table>
<p></p>
<!--End Footer Block-->
<?
	return 0;
}
?>