123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <?php
- require("../../class/connect.php");
- require("../../class/db_sql.php");
- require("../../member/class/user.php");
- require("../../data/dbcache/MemberLevel.php");
- require "../".LoadLang("pub/fun.php");
- $link=db_connect();
- $empire=new mysqlquery();
- //返回SQL
- function UserSearchDoKeyboard($f,$hh,$keyboard){
- $keyboard=RepPostVar2($keyboard);
- if(empty($keyboard))
- {
- return '';
- }
- if($hh=='EQ')
- {
- $where=$f."='".$keyboard."'";
- }
- else
- {
- $where=$f." LIKE '%".$keyboard."%'";
- }
- return $where;
- }
- $editor=1;
- eCheckCloseMods('member');//关闭模块
- eCheckCloseMods('mlist');//关闭模块
- if($public_r['memberlistlevel'])
- {
- $user=islogin();
- if($level_r[$user[groupid]]['level']<$level_r[$public_r[memberlistlevel]]['level'])
- {
- printerror("NotLevelMemberList","",1);
- }
- }
- $search='';
- $add='';
- $where=' where ';
- $query='';
- $totalquery='';
- //用户组
- $truegroupid=0;
- $formid=0;
- $groupid=RepPostVar($_GET['groupid']);
- if($groupid)
- {
- if(strstr($groupid,','))//多用户组
- {
- $gids='';
- $dh='';
- $gr=explode(',',$groupid);
- $truegroupid=intval($gr[0]);
- $gcount=count($gr);
- for($i=0;$i<$gcount;$i++)
- {
- $gid=(int)$gr[$i];
- $gids.=$dh.$gid;
- $dh=',';
- }
- $add.=' where u.'.egetmf('groupid').' in ('.$gids.')';
- }
- else
- {
- $groupid=(int)$groupid;
- $truegroupid=$groupid;
- $add.=" where u.".egetmf('groupid')."='$groupid'";
- }
- $where=' and ';
- $search.='&groupid='.$groupid;
- }
- //搜索
- $sear=$_GET['sear'];
- if($sear)
- {
- $search.='&sear=1';
- if($truegroupid)
- {
- $formid=GetMemberFormId($truegroupid);
- }
- $searchf='';
- $show=$_GET['show'];
- $hh=$_GET['hh'];
- $keyboard=$_GET['keyboard'];
- if($formid)
- {
- $uswhere='';
- $andor=$_GET['andor'];
- $andor=$andor=='and'?'and':'or';
- $search.='&andor='.$andor;
- $formr=$empire->fetch1("select searchvar from {$dbtbpre}enewsmemberform where fid='$formid'");
- if(empty($formr[searchvar]))
- {
- $formr[searchvar]=',';
- }
- $formr[searchvar].='username,';
- $count=count($show);
- for($i=0;$i<$count;$i++)
- {
- if(empty($show[$i]))
- {
- continue;
- }
- $show[$i]=str_replace(',','',$show[$i]);
- if(!strstr($formr[searchvar],','.$show[$i].','))
- {
- continue;
- }
- $show[$i]=RepPostVar($show[$i]);
- if(stristr(','.$searchf.',',','.$show[$i].','))
- {
- continue;
- }
- $dh=empty($searchf)?'':',';
- $searchf.=$dh.$show[$i];
- if($show[$i]=='username')
- {
- $f='u.`'.egetmf('username').'`';
- }
- else
- {
- $f='ui.`'.$show[$i].'`';
- }
- if(strlen($keyboard[$i])>$public_r['max_keyboard'])
- {
- printerror("MinKeyboard","",1);
- }
- $onewhere=UserSearchDoKeyboard($f,$hh[$i],$keyboard[$i]);
- if($onewhere)
- {
- $or=empty($uswhere)?'':' '.$andor.' ';
- $uswhere.=$or.'('.$onewhere.')';
- $search.='&show[]='.$show[$i].'&hh[]='.RepPostStr($hh[$i],1).'&keyboard[]='.RepPostStr($keyboard[$i],1);
- }
- }
- if($uswhere)
- {
- $add.=$where.'('.$uswhere.')';
- }
- }
- else
- {
- $searchf='username';
- if($keyboard[0])
- {
- if(strlen($keyboard[0])>$public_r['max_keyboard'])
- {
- printerror("MinKeyboard","",1);
- }
- $onewhere=UserSearchDoKeyboard('u.'.egetmf('username'),$hh[0],$keyboard[0]);
- if($onewhere)
- {
- $add.=$where.$onewhere;
- }
- }
- $search.='&hh[]='.RepPostStr($hh[0],1).'&keyboard[]='.RepPostStr($keyboard[0],1);
- }
- }
- $add=" LEFT JOIN {$dbtbpre}enewsmemberadd ui ON u.".egetmf('userid')."=ui.userid".$add;
- $page=(int)$_GET['page'];
- $page=RepPIntvar($page);
- $start=0;
- $line=$public_r['member_num'];//每页显示条数
- $page_line=10;//每页显示链接数
- $offset=$page*$line;//总偏移量
- $totalnum=(int)$_GET['totalnum'];
- if(!$public_r['usetotalnum'])
- {
- $totalnum=0;
- }
- if($totalnum<1)
- {
- $totalquery="select count(*) as total from ".eReturnMemberTable()." u".$add;
- $num=$empire->gettotal($totalquery);//取得总条数
- }
- else
- {
- $num=$totalnum;
- }
- if($public_r['usetotalnum'])
- {
- $search.='&totalnum='.$num;
- }
- //checkpageno
- eCheckListPageNo($page,$line,$num);
- //模板
- $tempid=(int)$_GET['tempid'];
- if(empty($tempid))
- {
- $tempid=1;
- }
- else
- {
- $search.='&tempid='.$tempid;
- }
- $tempfile=ECMS_PATH.'e/template/member/memberlist/'.$tempid.'.php';
- if(!file_exists($tempfile))
- {
- $tempfile=ECMS_PATH.'e/template/member/memberlist/1.php';
- }
- $returnpage=page1($num,$line,$page_line,$start,$page,$search);
- @require($tempfile);
- db_close();
- $empire=null;
- ?>
|