人人商城

founderdisplay.ctrl.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('user');
  8. $dos = array('display', 'operate');
  9. $do = in_array($do, $dos) ? $do: 'display';
  10. $_W['page']['title'] = '用户列表 - 用户管理';
  11. $founders = explode(',', $_W['config']['setting']['founder']);
  12. if ($do == 'display') {
  13. $condition = " WHERE u.founder_groupid = " . ACCOUNT_MANAGE_GROUP_VICE_FOUNDER;
  14. $pindex = max(1, intval($_GPC['page']));
  15. $psize = 20;
  16. $params = array();
  17. if (!empty($_GPC['username'])) {
  18. $condition .= " AND u.username LIKE :username";
  19. $params[':username'] = "%{$_GPC['username']}%";
  20. }
  21. $sql = 'SELECT u.*, p.avatar FROM ' . tablename('users') .' AS u LEFT JOIN ' . tablename('users_profile') . ' AS p ON u.uid = p.uid '. $condition . " LIMIT " . ($pindex - 1) * $psize .',' .$psize;
  22. $users = pdo_fetchall($sql, $params);
  23. $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('users') .' AS u '. $condition, $params);
  24. $pager = pagination($total, $pindex, $psize);
  25. $groups = user_group();
  26. $users = user_list_format($users);
  27. template('founder/founder-display');
  28. }
  29. if ($do == 'del') {
  30. $uid = intval($_GPC['uid']);
  31. $uid_user = user_single($uid);
  32. if (in_array($uid, $founders)) {
  33. itoast('访问错误, 无法操作站长.', url('founder/founderdisplay'), 'error');
  34. }
  35. if (empty($uid_user)) {
  36. exit('未指定用户,无法删除.');
  37. }
  38. user_delete($uid);
  39. itoast('删除成功!', referer(), 'success');
  40. }