zhanghao.inc.php 1.4 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. global $_GPC, $_W;
  3. $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
  4. $seller_id=$_COOKIE["storeid"];
  5. $uid=$_COOKIE["uid"];
  6. $GLOBALS['frames'] = $this->getMainMenu($seller_id, $action='start',$uid);
  7. if ($operation == 'display') {
  8. $strwhere = '';
  9. $pindex = max(1, intval($_GPC['page']));
  10. $psize = 10;
  11. $list = pdo_fetchall("SELECT a.*,b.username AS username,b.status AS status FROM " . tablename('zhtc_account') . " a LEFT JOIN
  12. " . tablename('users') . " b ON a.uid=b.uid where a.weid={$_W['uniacid']} and a.role=2 ORDER BY id DESC LIMIT
  13. " . ($pindex - 1) * $psize . ',' . $psize, $data);
  14. if (!empty($list)) {
  15. $total = pdo_fetchcolumn('SELECT COUNT(1) FROM ' . tablename('zhtc_account') . " WHERE weid = :weid and role=2", array(':weid' => $_W['uniacid']));
  16. $pager = pagination($total, $pindex, $psize);
  17. }
  18. }else if ($operation == 'delete') {
  19. $id = intval($_GPC['id']);
  20. $item = pdo_fetch("SELECT * FROM " . tablename('zhtc_account') . " WHERE id = '$id'");
  21. if (empty($item)) {
  22. message('抱歉,不存在或是已经被删除!', $this->createWebUrl('zhanghao', array('op' => 'display')), 'error');
  23. }
  24. pdo_delete('users', array('uid' => $item['uid']));
  25. pdo_delete('zhtc_account', array('id' => $id, 'weid' => $_W['uniacid']));
  26. message('删除成功!', $this->createWebUrl('zhanghao', array('op' => 'display')), 'success');
  27. }
  28. include $this->template('web/zhanghao');