本文整理汇总了PHP中utils::_filter_input方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::_filter_input方法的具体用法?PHP utils::_filter_input怎么用?PHP utils::_filter_input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::_filter_input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login($userData, $vcode = false, &$msg, $type = 'b2c')
{
$userData = utils::_filter_input($userData);
//过滤xss攻击
//快速登录不用验证码
if ($vcode != 'quick') {
if (!$vcode || !base_vcode::verify('passport', $vcode)) {
$msg = '验证码错误';
return false;
}
}
//如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
if (!$userData['login_type']) {
$userPassport = vmc::singleton('b2c_user_passport');
$userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']);
}
$filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']);
$model = 'members';
$id = 'member_id';
if ($type == 'sellers') {
$model = 'sellers';
$id = 'seller_id';
}
$account = app::get('pam')->model($model)->getList($id . ',password_account,login_password,createtime', $filter);
if (!$account) {
$msg = '不存在的用户';
return false;
}
$login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account']));
if ($account[0]['login_password'] != $login_password) {
$msg = '登录密码错误';
return false;
}
return $account[0][$id];
}
示例2: login
/**
* 认证用户名密码以及验证码等
*
* @param array $usrdata 认证提示信息
*
* @return bool|int返回认证成功与否
*/
public function login($data)
{
$data = utils::_filter_input($data);
$accountId = $this->__verifyLogin($data['uname'], $data['password']);
pamAccount::setSession($accountId, trim($data['uname']));
return $rows['account_id'];
}
示例3: seller_login
public function seller_login($userData, $vcode = false, &$msg)
{
$userData = utils::_filter_input($userData);
//过滤xss攻击
if (!$vcode || !base_vcode::verify('passport', $vcode)) {
$msg = '验证码错误';
return false;
}
//如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
if (!$userData['login_type']) {
$userPassport = vmc::singleton('seller_user_passport');
$userData['login_type'] = $userPassport->get_login_account_type($userData['login_name']);
}
$filter = array('login_type' => $userData['login_type'], 'login_name' => $userData['login_name']);
$account = app::get('seller')->model('sellers')->getList('member_id, login_name, createtime', $filter);
if (!$account) {
$msg = '不存在的用户';
return false;
}
$login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['login_name']));
if ($account[0]['login_password'] != $login_password) {
$msg = '登录密码错误';
return false;
}
return $account[0]['member_id'];
}
示例4: post_login
public function post_login()
{
$login_url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_passport', 'act' => 'login'));
//_POST过滤
$params = utils::_filter_input($_POST);
unset($_POST);
$account_data = array('login_account' => $params['uname'], 'login_password' => $params['password']);
if (empty($params['vcode'])) {
$this->splash('error', $login_url, '请输入验证码');
}
//尝试登陆
$member_id = vmc::singleton('pam_passport_site_basic')->login($account_data, $params['vcode'], $msg);
if (!$member_id) {
$this->splash('error', $login_url, $msg);
}
$mdl_members = $this->app->model('members');
$member_data = $mdl_members->getRow('member_lv_id,experience', array('member_id' => $member_id));
if (!$member_data) {
$this->splash('error', $login_url, '会员数据异常!');
}
$member_data['order_num'] = $this->app->model('orders')->count(array('member_id' => $member_id));
//更新会员数据
$mdl_members->update($member_data, array('member_id' => $member_id));
//设置session
$this->user_obj->set_member_session($member_id);
//设置客户端cookie
$this->bind_member($member_id);
$forward = $params['forward'];
if (!$forward) {
$forward = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_member', 'act' => 'index'));
}
$this->splash('success', $forward, '登录成功');
}
示例5: login
public function login($userData, $vcode = false, &$msg)
{
$userData = utils::_filter_input($userData);
//过滤xss攻击
if ($vcode && !$this->vcode_verify($vcode)) {
$msg = app::get('pam')->_('验证码错误');
return false;
}
//如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
if (!$userData['login_type']) {
$userPassport = kernel::single('b2c_user_passport');
$userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']);
}
$filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']);
$account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter);
if (!$account) {
$msg = app::get('pam')->_('用户名或密码错误');
return false;
}
$login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account']));
if ($account[0]['login_password'] != $login_password) {
$msg = app::get('pam')->_('用户名或密码错误');
return false;
}
return $account[0]['member_id'];
}
示例6: post_login
public function post_login()
{
$login_url = $this->gen_url(array('app' => 'seller', 'ctl' => 'site_passport', 'act' => 'login'));
//_POST过滤
$params = utils::_filter_input($_POST);
unset($_POST);
$account_data = array('login_account' => $params['uname'], 'login_password' => $params['password']);
if (empty($params['vcode'])) {
$this->splash('error', $login_url, '请输入验证码');
}
//尝试登陆
$seller_id = vmc::singleton('pam_passport_site_basic')->login($account_data, $params['vcode'], $msg, 'sellers');
if (!$seller_id) {
$this->splash('error', $login_url, $msg);
}
//设置session
$this->user_obj->set_seller_session($seller_id);
//设置客户端cookie
$this->bind_seller($seller_id);
$forward = $params['forward'];
if (!$forward) {
$forward = $this->gen_url(array('app' => 'seller', 'ctl' => 'site_seller', 'act' => 'index'));
}
$this->splash('success', $forward, '登录成功');
}
示例7: index
public function index($cat_id = '', $urlFilter = null, $orderBy = 0, $page = 1, $virtual_cat_id = null, $showtype = null)
{
$request_params = $this->_request->get_params();
$request_params = utils::_filter_input($request_params);
$urlFilter = utils::_filter_input($urlFilter);
$urlFilter = htmlspecialchars(urldecode($urlFilter));
$_GET['scontent'] = htmlspecialchars($_GET['scontent']);
if (!empty($urlFilter) && $urlFilter != $_GET['scontent']) {
$urlFilter .= '_' . $_GET['scontent'];
} else {
$urlFilter = $_GET['scontent'];
}
if (empty($cat_id) && empty($urlFilter)) {
$url = $this->gen_url(array('app' => 'wap', 'ctl' => 'default', 'act' => 'index'));
$this->_response->set_redirect($url)->send_headers();
}
$oSearch = $this->app->model('search');
$tmp_filter = $oSearch->decode($urlFilter);
if ($request_params[5] || $_GET['virtual_cat_id']) {
$virtual_cat_id = $request_params[5] ? $request_params[5] : intval($_GET['virtual_cat_id']);
}
$params = $this->filter_decode($tmp_filter, $cat_id, $virtual_cat_id);
$page = $params['page'] ? $params['page'] : $page;
$this->pagedata['filter'] = $params['params'];
$goodsData = $this->get_goods($params['filter'], $page, $params['orderby']);
$screen = $this->screen($cat_id, $params['params']);
$this->pagedata['screen'] = $screen['screen'];
$this->pagedata['active_filter'] = $screen['active_filter'];
$this->pagedata['orderby_sql'] = $params['orderby'];
$this->pagedata['showtype'] = $params['showtype'];
$this->pagedata['is_store'] = $params['is_store'];
$this->pagedata['goodsData'] = $goodsData;
if ($tmp_filter['search_keywords'][0]) {
$tmp_filter['search_keywords'][0] = str_replace('%xia%', '_', $tmp_filter['search_keywords'][0]);
}
//面包屑
$GLOBALS['runtime']['path'] = $this->runtime_path($cat_id, $tmp_filter['search_keywords'][0], $virtual_cat_id);
//搜索关键字
if (isset($tmp_filter['search_keywords'][0])) {
$keywords = str_replace(' ', '%20', $tmp_filter['search_keywords'][0]);
$this->set_cookie('S[SEARCH_KEY]', $keywords);
}
//setSeo
$this->_set_seo($screen['seo_info']);
if (in_array('gallery-index', $this->weixin_share_page)) {
$this->pagedata['from_weixin'] = $this->from_weixin;
$this->pagedata['weixin']['appid'] = $this->weixin_a_appid;
$this->pagedata['weixin']['imgUrl'] = base_storager::image_path(app::get('weixin')->getConf('weixin_basic_setting.weixin_logo'));
$this->pagedata['weixin']['linelink'] = app::get('wap')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'wap_gallery', 'act' => 'index', 'arg0' => $cat_id, 'full' => 1));
$this->pagedata['weixin']['shareTitle'] = $this->title;
$this->pagedata['weixin']['descContent'] = $this->description;
}
$this->set_tmpl('gallery');
$this->page('wap/gallery/index.html');
}
示例8: index
public function index($cat_id = '', $urlFilter = null, $orderBy = 0, $page = 1, $virtual_cat_id = null, $showtype = null)
{
$request_params = $this->_request->get_params();
$urlFilter = utils::_filter_input($urlFilter);
$urlFilter = htmlspecialchars(urldecode($urlFilter));
$_GET['scontent'] = htmlspecialchars($_GET['scontent']);
if (!empty($urlFilter) && $urlFilter != $_GET['scontent']) {
$urlFilter .= '_' . $_GET['scontent'];
} else {
$urlFilter = $_GET['scontent'];
}
if (empty($cat_id) && empty($urlFilter)) {
$url = $this->gen_url(array('app' => 'site', 'ctl' => 'default', 'act' => 'index'));
$this->_response->set_redirect($url)->send_headers();
}
$oSearch = $this->app->model('search');
$tmp_filter = $oSearch->decode($urlFilter);
if ($request_params[5] || $_GET['virtual_cat_id']) {
$virtual_cat_id = $request_params[5] ? $request_params[5] : intval($_GET['virtual_cat_id']);
}
$params = $this->filter_decode($tmp_filter, $cat_id, $virtual_cat_id);
$page = $params['page'] ? $params['page'] : $page;
$this->pagedata['filter'] = $params['params'];
$goodsData = $this->get_goods($params['filter'], $page, $params['orderby']);
$screen = $this->screen($cat_id, $params['params']);
$this->pagedata['screen'] = $screen['screen'];
$this->pagedata['active_filter'] = $screen['active_filter'];
$this->pagedata['orderby_sql'] = $params['orderby'];
$this->pagedata['showtype'] = $params['showtype'];
$this->pagedata['is_store'] = $params['is_store'];
$goodsData = $this->get_marketable($goodsData);
$this->pagedata['goodsData'] = $goodsData;
// echo $goodsData[0][products][spec_desc][spec_value_id][0];
// exit;
if ($tmp_filter['search_keywords'][0]) {
$tmp_filter['search_keywords'][0] = str_replace('%xia%', '_', $tmp_filter['search_keywords'][0]);
}
//面包屑
$GLOBALS['runtime']['path'] = $this->runtime_path($cat_id, $tmp_filter['search_keywords'][0], $virtual_cat_id);
//搜索关键字
if (isset($tmp_filter['search_keywords'][0])) {
$keywords = str_replace(' ', '%20', $tmp_filter['search_keywords'][0]);
$this->set_cookie('S[SEARCH_KEY]', $keywords);
}
//setSeo
$this->_set_seo($screen['seo_info']);
//设置模板
if ($this->goods_cat_setting['gallery_template']) {
$this->set_tmpl_file($this->goods_cat_setting['gallery_template']);
//添加模板
}
$this->set_tmpl('gallery');
$this->page('site/gallery/index.html');
}
示例9: up
public function up($params)
{
$params = utils::_filter_input($params);
$shopId = $this->__checkAuth($params);
$filter['disabled'] = 0;
$filter['target_id'] = $shopId;
$filter['target_type'] = 'shop';
$filter['url'] = $params['url'];
$resultData = app::get('image')->model('images')->update(['image_name' => $params['image_name']], $filter);
return $resultData;
}
示例10: arrContentReplace
private function arrContentReplace($array)
{
if (is_array($array)) {
foreach ($array as $key => $v) {
$array[$key] = $this->arrContentReplace($array[$key]);
}
} else {
$array = strip_tags($array);
$array = utils::_filter_input($array);
//过滤xss攻击
}
return $array;
}
示例11: saveSelfUser
public function saveSelfUser()
{
$postdata = utils::_filter_input(input::get('seller'));
$objSeller = kernel::single('sysshop_data_seller');
try {
$this->adminlog("添加自营用户[{$postdata['login_account']}]", 1);
$objSeller->saveSelf($postdata);
} catch (Exception $e) {
$this->adminlog("添加自营用户[{$postdata['login_account']}]", 0);
$msg = $e->getMessage();
return $this->splash('error', null, $msg);
}
return $this->splash('success', null, "自营用户添加成功");
}
示例12: index
public function index($fix_brand = false)
{
$params = utils::_filter_input($_GET);
$query_str = $this->_query_str($params);
$this->pagedata['query'] = $this->_query_str($params, 0);
$params = $this->_params_decode($params);
$filter = $params['filter'];
if (!$fix_brand && $filter['cat_id']) {
$mdl_cat = $this->app->model('goods_cat');
$cat_info = $mdl_cat->dump($filter['cat_id']);
if ($cat_info['gallery_setting']['mobile_template']) {
$this->set_tmpl_file($cat_info['gallery_setting']['mobile_template']);
//设置模板文件
}
$this->_info = $cat_info['seo_info'];
$this->pagedata['cat_path'] = $mdl_cat->getPath($filter['cat_id']);
} elseif ($fix_brand) {
$filter['brand_id'] = $fix_brand;
}
$goods_list = $this->_list($filter, $params['page'], $params['orderby']);
$this->pagedata['data_list'] = $goods_list['data'];
$this->pagedata['count'] = $goods_list['count'];
$this->pagedata['all_count'] = $goods_list['all_count'];
$this->pagedata['pager'] = $goods_list['page_info'];
$this->pagedata['pager']['token'] = time();
$this->pagedata['pager']['link'] = $this->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_list', 'act' => 'index', 'full' => 1)) . '?page=' . $this->pagedata['pager']['token'] . ($query_str ? '&' . $query_str : '');
if (!$fix_brand) {
$this->pagedata['data_screen'] = vmc::singleton('b2c_goods_stage')->screening_data_by_cat($filter['cat_id']);
} else {
$brand = app::get('b2c')->model('brand')->dump($fix_brand);
$this->pagedata['brand'] = $brand;
$this->pagedata['data_screen'] = vmc::singleton('b2c_goods_stage')->screening_data_by_brand($fix_brand);
$this->set_tmpl('brandlist');
//锁定品牌型列表模板
$brand_setting = $brand['brand_setting'];
if ($brand_setting['mobile_template']) {
$this->set_tmpl_file($brand_setting['mobile_template']);
}
}
if ($this->_request->is_ajax()) {
//ajax 请求不经过模板机制
$this->display('mobile/list/index.html');
} else {
$this->page('mobile/list/index.html');
}
}
示例13: login_webpos
public function login_webpos($userData, $vcode = false, &$msg, $post_date = '')
{
$userData = utils::_filter_input($userData);
//过滤xss攻击
//如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录)
if (!$userData['login_type']) {
$userPassport = kernel::single('b2c_user_passport');
$userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']);
}
$filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']);
$account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter);
if (!$account) {
$msg = app::get('pam')->_('用户名或密码错误');
return false;
}
if (isset($_SESSION['local_store']) && $_SESSION['local_store']['branch_id'] > 0) {
$obj_local_store = app::get('ome')->model('branch');
$local_store_list = $obj_local_store->getList('*', array('branch_id' => intval($_SESSION['local_store']['branch_id'])), 0, 1);
//$local_store = $obj_local_store->dump();
$local_store = $local_store_list[0];
if ($local_store) {
$_SESSION['local_store'] = $local_store;
}
$obj_member_addrs = app::get('b2c')->model('member_addrs');
$member_addrs = $obj_member_addrs->getList('*', array('member_id' => $account[0]['member_id'], 'local_id' => $local_store['branch_id']), 0, 1);
$in_addr_data = $local_store;
$in_addr_data['member_id'] = $account[0]['member_id'];
unset($in_addr_data['name']);
if ($member_addrs[0]) {
$in_addr_data['addr_id'] = $member_addrs[0]['addr_id'];
}
$in_addr_data['addr'] = $in_addr_data['address'];
$in_addr_data['name'] = $account[0]['password_account'];
$in_addr_data['local_id'] = $in_addr_data['branch_id'];
$in_addr_data['tel'] = $in_addr_data['phone'];
$in_addr_data['time'] = time();
// print_r($in_addr_data);exit;
kernel::single('b2c_member_addrs')->purchase_save_addr($in_addr_data, $in_addr_data['member_id'], $msg);
}
return $account[0]['member_id'];
}
示例14: doSave
public function doSave($params)
{
$objMdlFeedback = app::get('sysrate')->model('feedback');
$data['name'] = $params['name'];
$data['email'] = $params['email'];
$data['tel'] = $params['tel'];
$data['question'] = $params['question'];
if ($params['oauth']['auth_type'] == 'shop') {
$data['seller_id'] = $params['oauth']['account_id'];
}
if (!$data['seller_id']) {
throw new \LogicException('无操作权限,请重新登录');
}
$data['shop_id'] = app::get('sysrate')->rpcCall('shop.get.loginId', array('seller_id' => $data['seller_id']), 'seller');
try {
//检查数据安全
$data = utils::_filter_input($data);
$objMdlFeedback->save($data);
} catch (Exception $e) {
throw new \LogicException($e->getMessage());
}
return true;
}
示例15: login
/**
* 登录调用的方法.
*
* @param array $params 认证传递的参数,包含认证类型,跳转地址等
*/
public function login($params)
{
$params['module'] = utils::_filter_input($params['module']);
//过滤xss攻击
$auth = pam_auth::instance($params['type']);
$auth->set_appid($params['appid']);
if (!class_exists($params['module'])) {
vmc::singleton('site_router')->http_status(500);
}
if ($params['module']) {
if (class_exists($params['module']) && ($passport_module = vmc::singleton($params['module']))) {
if ($passport_module instanceof pam_interface_passport) {
$module_uid = $passport_module->login($auth, $auth_data);
if ($module_uid) {
$auth_data['account_type'] = $params['type'];
$auth->account()->update($params['module'], $module_uid, $auth_data);
}
$log = array('event_time' => time(), 'event_type' => $auth->type, 'event_data' => base_request::get_remote_addr() . ':' . $auth_data['log_data'] . ':' . $_SERVER['HTTP_REFERER']);
app::get('pam')->model('log_desktop')->insert($log);
if (!$module_uid) {
$_SESSION['last_error'] = $auth_data['log_data'];
}
$_SESSION['type'] = $auth->type;
$_SESSION['login_time'] = time();
$params['member_id'] = $_SESSION['account'][$params['type']];
$params['uname'] = $_POST['uname'];
foreach (vmc::servicelist('pam_login_listener') as $service) {
$service->listener_login($params);
}
if ($params['redirect'] && $module_uid) {
$service = vmc::service('callback_infomation');
if (is_object($service)) {
if (method_exists($service, 'get_callback_infomation') && $module_uid) {
$data = $service->get_callback_infomation($module_uid, $params['type']);
if (!$data) {
$url = '';
} else {
$url = '?' . utils::http_build_query($data);
}
}
}
}
if ($_COOKIE['autologin'] > 0) {
vmc::singleton('base_session')->set_cookie_expires($_COOKIE['autologin']);
//如果自动登录,设置cookie过期时间,单位:分
}
if ($_COOKIE['S']['SIGN']['AUTO'] > 0) {
$minutes = 10 * 24 * 60;
vmc::singleton('base_session')->set_cookie_expires($minutes);
}
if ($_SESSION['callback'] && !$module_uid) {
$callback_url = $_SESSION['callback'];
unset($_SESSION['callback']);
header('Location:' . urldecode($callback_url));
exit;
} else {
$url = base64_decode(str_replace('%2F', '/', urldecode($params['redirect']))) . $url;
if (!$url) {
foreach (vmc::$url_app_map as $key => $value) {
$app = current($value);
if ($app == 'desktop') {
$url = $key;
}
}
}
header('Location: ' . $url);
exit;
}
}
} else {
}
}
}