index.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?php
  2. require("../../class/connect.php");
  3. require("../../class/db_sql.php");
  4. require("../../member/class/user.php");
  5. require("../../data/dbcache/MemberLevel.php");
  6. require "../".LoadLang("pub/fun.php");
  7. $link=db_connect();
  8. $empire=new mysqlquery();
  9. //返回SQL
  10. function UserSearchDoKeyboard($f,$hh,$keyboard){
  11. $keyboard=RepPostVar2($keyboard);
  12. if(empty($keyboard))
  13. {
  14. return '';
  15. }
  16. if($hh=='EQ')
  17. {
  18. $where=$f."='".$keyboard."'";
  19. }
  20. else
  21. {
  22. $where=$f." LIKE '%".$keyboard."%'";
  23. }
  24. return $where;
  25. }
  26. $editor=1;
  27. eCheckCloseMods('member');//关闭模块
  28. eCheckCloseMods('mlist');//关闭模块
  29. if($public_r['memberlistlevel'])
  30. {
  31. $user=islogin();
  32. if($level_r[$user[groupid]]['level']<$level_r[$public_r[memberlistlevel]]['level'])
  33. {
  34. printerror("NotLevelMemberList","",1);
  35. }
  36. }
  37. $search='';
  38. $add='';
  39. $where=' where ';
  40. $query='';
  41. $totalquery='';
  42. //用户组
  43. $truegroupid=0;
  44. $formid=0;
  45. $groupid=RepPostVar($_GET['groupid']);
  46. if($groupid)
  47. {
  48. if(strstr($groupid,','))//多用户组
  49. {
  50. $gids='';
  51. $dh='';
  52. $gr=explode(',',$groupid);
  53. $truegroupid=intval($gr[0]);
  54. $gcount=count($gr);
  55. for($i=0;$i<$gcount;$i++)
  56. {
  57. $gid=(int)$gr[$i];
  58. $gids.=$dh.$gid;
  59. $dh=',';
  60. }
  61. $add.=' where u.'.egetmf('groupid').' in ('.$gids.')';
  62. }
  63. else
  64. {
  65. $groupid=(int)$groupid;
  66. $truegroupid=$groupid;
  67. $add.=" where u.".egetmf('groupid')."='$groupid'";
  68. }
  69. $where=' and ';
  70. $search.='&groupid='.$groupid;
  71. }
  72. //搜索
  73. $sear=$_GET['sear'];
  74. if($sear)
  75. {
  76. $search.='&sear=1';
  77. if($truegroupid)
  78. {
  79. $formid=GetMemberFormId($truegroupid);
  80. }
  81. $searchf='';
  82. $show=$_GET['show'];
  83. $hh=$_GET['hh'];
  84. $keyboard=$_GET['keyboard'];
  85. if($formid)
  86. {
  87. $uswhere='';
  88. $andor=$_GET['andor'];
  89. $andor=$andor=='and'?'and':'or';
  90. $search.='&andor='.$andor;
  91. $formr=$empire->fetch1("select searchvar from {$dbtbpre}enewsmemberform where fid='$formid'");
  92. if(empty($formr[searchvar]))
  93. {
  94. $formr[searchvar]=',';
  95. }
  96. $formr[searchvar].='username,';
  97. $count=count($show);
  98. for($i=0;$i<$count;$i++)
  99. {
  100. if(empty($show[$i]))
  101. {
  102. continue;
  103. }
  104. $show[$i]=str_replace(',','',$show[$i]);
  105. if(!strstr($formr[searchvar],','.$show[$i].','))
  106. {
  107. continue;
  108. }
  109. $show[$i]=RepPostVar($show[$i]);
  110. if(stristr(','.$searchf.',',','.$show[$i].','))
  111. {
  112. continue;
  113. }
  114. $dh=empty($searchf)?'':',';
  115. $searchf.=$dh.$show[$i];
  116. if($show[$i]=='username')
  117. {
  118. $f='u.`'.egetmf('username').'`';
  119. }
  120. else
  121. {
  122. $f='ui.`'.$show[$i].'`';
  123. }
  124. if(strlen($keyboard[$i])>$public_r['max_keyboard'])
  125. {
  126. printerror("MinKeyboard","",1);
  127. }
  128. $onewhere=UserSearchDoKeyboard($f,$hh[$i],$keyboard[$i]);
  129. if($onewhere)
  130. {
  131. $or=empty($uswhere)?'':' '.$andor.' ';
  132. $uswhere.=$or.'('.$onewhere.')';
  133. $search.='&show[]='.$show[$i].'&hh[]='.RepPostStr($hh[$i],1).'&keyboard[]='.RepPostStr($keyboard[$i],1);
  134. }
  135. }
  136. if($uswhere)
  137. {
  138. $add.=$where.'('.$uswhere.')';
  139. }
  140. }
  141. else
  142. {
  143. $searchf='username';
  144. if($keyboard[0])
  145. {
  146. if(strlen($keyboard[0])>$public_r['max_keyboard'])
  147. {
  148. printerror("MinKeyboard","",1);
  149. }
  150. $onewhere=UserSearchDoKeyboard('u.'.egetmf('username'),$hh[0],$keyboard[0]);
  151. if($onewhere)
  152. {
  153. $add.=$where.$onewhere;
  154. }
  155. }
  156. $search.='&hh[]='.RepPostStr($hh[0],1).'&keyboard[]='.RepPostStr($keyboard[0],1);
  157. }
  158. }
  159. $add=" LEFT JOIN {$dbtbpre}enewsmemberadd ui ON u.".egetmf('userid')."=ui.userid".$add;
  160. $page=(int)$_GET['page'];
  161. $page=RepPIntvar($page);
  162. $start=0;
  163. $line=$public_r['member_num'];//每页显示条数
  164. $page_line=10;//每页显示链接数
  165. $offset=$page*$line;//总偏移量
  166. $totalnum=(int)$_GET['totalnum'];
  167. if(!$public_r['usetotalnum'])
  168. {
  169. $totalnum=0;
  170. }
  171. if($totalnum<1)
  172. {
  173. $totalquery="select count(*) as total from ".eReturnMemberTable()." u".$add;
  174. $num=$empire->gettotal($totalquery);//取得总条数
  175. }
  176. else
  177. {
  178. $num=$totalnum;
  179. }
  180. if($public_r['usetotalnum'])
  181. {
  182. $search.='&totalnum='.$num;
  183. }
  184. //checkpageno
  185. eCheckListPageNo($page,$line,$num);
  186. //模板
  187. $tempid=(int)$_GET['tempid'];
  188. if(empty($tempid))
  189. {
  190. $tempid=1;
  191. }
  192. else
  193. {
  194. $search.='&tempid='.$tempid;
  195. }
  196. $tempfile=ECMS_PATH.'e/template/member/memberlist/'.$tempid.'.php';
  197. if(!file_exists($tempfile))
  198. {
  199. $tempfile=ECMS_PATH.'e/template/member/memberlist/1.php';
  200. }
  201. $returnpage=page1($num,$line,$page_line,$start,$page,$search);
  202. @require($tempfile);
  203. db_close();
  204. $empire=null;
  205. ?>