function upload_member($strs, $time) { global $_W; $userid = $strs[0]; $username = $strs[1]; if (empty($userid) || empty($username)) { return 0; } $insert = array(); $insert['userid'] = $userid; $flag = check_userid($insert, 0); if ($flag == 0) { $insert['username'] = $username; $insert['weid'] = $_W['weid']; $insert['createtime'] = $time; $insert['status'] = 1; pdo_insert('ewei_exam_member', $insert); } }
public function doWebMember() { global $_GPC, $_W; $op = $_GPC['op']; if ($op == 'edit') { $id = intval($_GPC['id']); if (!empty($id)) { $item = pdo_fetch("SELECT * FROM " . tablename('ewei_exam_member') . " WHERE id = :id", array(':id' => $id)); if (empty($item)) { message('抱歉,用户不存在或是已经删除!', '', 'error'); } } if (checksubmit('submit')) { if (empty($_GPC['username'])) { message('抱歉,姓名不能为空!', '', 'error'); } // if (empty($_GPC['userid'])) { // message('抱歉,用户名不能为空!', '', 'error'); // } $data = array('weid' => $_W['uniacid'], 'username' => $_GPC['username'], 'mobile' => $_GPC['mobile'], 'email' => $_GPC['email'], 'status' => $_GPC['status']); if (!empty($_GPC['userid'])) { $data['userid'] = $_GPC['userid']; } $check_flag = check_userid($data, $id); if ($check_flag) { message('抱歉,用户名已经存在!', '', 'error'); } //print_r($check_flag);exit; if (empty($id)) { $data['createtime'] = time(); pdo_insert('ewei_exam_member', $data); } else { unset($data['weid']); pdo_update('ewei_exam_member', $data, array('id' => $id)); } message('用户信息更新成功!', $this->createWebUrl('member'), 'success'); } include $this->template('member_form'); } else { if ($op == 'delete') { $id = intval($_GPC['id']); pdo_delete('ewei_exam_member', array('id' => $id)); message('删除成功!', referer(), 'success'); } else { if ($op == 'deleteall') { foreach ($_GPC['idArr'] as $k => $id) { $id = intval($id); pdo_delete('ewei_exam_member', array('id' => $id)); } exit; //message('规则操作成功!', '', 0); //exit(); } else { if ($op == 'showall') { if ($_GPC['show_name'] == 'showall') { $show_status = 1; } else { $show_status = 0; } foreach ($_GPC['idArr'] as $k => $id) { $id = intval($id); if (!empty($id)) { pdo_update('ewei_exam_member', array('status' => $show_status), array('id' => $id)); } } //message('操作成功!', '', 0); //exit(); } else { if ($op == 'status') { $id = intval($_GPC['id']); if (empty($id)) { message('抱歉,传递的参数错误!', '', 'error'); } $temp = pdo_update('ewei_exam_member', array('status' => $_GPC['status']), array('id' => $id)); if ($temp == false) { message('抱歉,刚才操作数据失败!', '', 'error'); } else { message('状态设置成功!', referer(), 'success'); } } else { $where = ' WHERE `weid` = :weid'; $params = array(':weid' => $_W['uniacid']); if (!empty($_GPC['username'])) { $where .= ' AND `username` LIKE :username'; $params[':username'] = "******"; } if (!empty($_GPC['userid'])) { $where .= ' AND `userid` LIKE :userid'; $params[':userid'] = "%{$_GPC['userid']}%"; } if (!empty($_GPC['mobile'])) { $where .= ' AND `mobile` LIKE :mobile'; $params[':mobile'] = "%{$_GPC['mobile']}%"; } $sql = 'SELECT COUNT(*) FROM ' . tablename('ewei_exam_member') . $where; $total = pdo_fetchcolumn($sql, $params); if ($total > 0) { $pindex = max(1, intval($_GPC['page'])); $psize = 15; $sql = 'SELECT * FROM ' . tablename('ewei_exam_member') . $where . ' ORDER BY `id` DESC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize; $list = pdo_fetchall($sql, $params); $pager = pagination($total, $pindex, $psize); } include $this->template('member'); } } } } } }