ECShop登录后依然可以正常显示打开登录和注册页面错误修复
日期:2015-03-20
大家在使用ECShop网店程序有没发现,用户登录后依然可以正常显示打开登录和注册页面问题。
站长们测测你自己的网站,首先随便一个用户登录网站后,再尝试分别打开,注册页面:https://www.ecshopok.com/user.php?act=register、登录页面:https://www.ecshopok.com/user.php?act=login、购物车里的登录页面:https://www.ecshopok.com/flow.php?step=login,我们会发现用户登录后这3个页面依然可以正常打开显示。此问题也是一个严重的BUG,ECSHOP插件网(www.ecshopok.com)提供完善的解决方案如下操作:
一、打开/user.php文件找到:
二、打开/flow.php文件找到:
站长们测测你自己的网站,首先随便一个用户登录网站后,再尝试分别打开,注册页面:https://www.ecshopok.com/user.php?act=register、登录页面:https://www.ecshopok.com/user.php?act=login、购物车里的登录页面:https://www.ecshopok.com/flow.php?step=login,我们会发现用户登录后这3个页面依然可以正常打开显示。此问题也是一个严重的BUG,ECSHOP插件网(www.ecshopok.com)提供完善的解决方案如下操作:
一、打开/user.php文件找到:
// $smarty->assign('back_act', $back_act); $smarty->display('user_passport.dwt');修改为如下代码:
// $smarty->assign('back_act', $back_act); if ($_SESSION['user_id'] == 0) { $smarty->display('user_passport.dwt'); } else { ecs_header("Location: user.php\n"); exit; }再接着找到:
$smarty->assign('back_act', $back_act); $smarty->display('user_passport.dwt');修改为如下代码:
$smarty->assign('back_act', $back_act); if ($_SESSION['user_id'] == 0) { $smarty->display('user_passport.dwt'); } else { ecs_header("Location: user.php\n"); exit; }
二、打开/flow.php文件找到:
elseif ($_REQUEST['step'] == 'login') { include_once('languages/'. $_CFG['lang']. '/user.php'); /* * 用户登录注册 */ if ($_SERVER['REQUEST_METHOD'] == 'GET') { $smarty->assign('anonymous_buy', $_CFG['anonymous_buy']); /* 检查是否有赠品,如果有提示登录后重新选择赠品 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift > 0"; if ($db->getOne($sql) > 0) { $smarty->assign('need_rechoose_gift', 1); } /* 检查是否需要注册码 */ $captcha = intval($_CFG['captcha']); if (($captcha & CAPTCHA_LOGIN) && (!($captcha & CAPTCHA_LOGIN_FAIL) || (($captcha & CAPTCHA_LOGIN_FAIL) && $_SESSION['login_fail'] > 2)) && gd_version() > 0) { $smarty->assign('enabled_login_captcha', 1); $smarty->assign('rand', mt_rand()); } if ($captcha & CAPTCHA_REGISTER) { $smarty->assign('enabled_register_captcha', 1); $smarty->assign('rand', mt_rand()); } } else { include_once('includes/lib_passport.php'); if (!empty($_POST['act']) && $_POST['act'] == 'signin') { $captcha = intval($_CFG['captcha']); if (($captcha & CAPTCHA_LOGIN) && (!($captcha & CAPTCHA_LOGIN_FAIL) || (($captcha & CAPTCHA_LOGIN_FAIL) && $_SESSION['login_fail'] > 2)) && gd_version() > 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } /* 检查验证码 */ include_once('includes/cls_captcha.php'); $validator = new captcha(); $validator->session_word = 'captcha_login'; if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } } $_POST['password']=isset($_POST['password']) ? trim($_POST['password']) : ''; if ($user->login($_POST['username'], $_POST['password'],isset($_POST['remember']))) { update_user_info(); //更新用户信息 recalculate_price(); // 重新计算购物车中的商品价格 /* 检查购物车中是否有商品 没有商品则跳转到首页 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "' "; if ($db->getOne($sql) > 0) { ecs_header("Location: flow.php?step=checkout\n"); } else { ecs_header("Location:index.php\n"); } exit; } else { $_SESSION['login_fail']++; show_message($_LANG['signin_failed'], '', 'flow.php?step=login'); } } elseif (!empty($_POST['act']) && $_POST['act'] == 'signup') { if ((intval($_CFG['captcha']) & CAPTCHA_REGISTER) && gd_version() > 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } /* 检查验证码 */ include_once('includes/cls_captcha.php'); $validator = new captcha(); if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } } if (register(trim($_POST['username']), trim($_POST['password']), trim($_POST['email']))) { /* 用户注册成功 */ ecs_header("Location: flow.php?step=consignee\n"); exit; } else { $err->show(); } } else { // TODO: 非法访问的处理 } } }修改为如下代码:
elseif ($_REQUEST['step'] == 'login') { if ($_SESSION['user_id'] == 0) { include_once('languages/'. $_CFG['lang']. '/user.php'); /* * 用户登录注册 */ if ($_SERVER['REQUEST_METHOD'] == 'GET') { $smarty->assign('anonymous_buy', $_CFG['anonymous_buy']); /* 检查是否有赠品,如果有提示登录后重新选择赠品 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift > 0"; if ($db->getOne($sql) > 0) { $smarty->assign('need_rechoose_gift', 1); } /* 检查是否需要注册码 */ $captcha = intval($_CFG['captcha']); if (($captcha & CAPTCHA_LOGIN) && (!($captcha & CAPTCHA_LOGIN_FAIL) || (($captcha & CAPTCHA_LOGIN_FAIL) && $_SESSION['login_fail'] > 2)) && gd_version() > 0) { $smarty->assign('enabled_login_captcha', 1); $smarty->assign('rand', mt_rand()); } if ($captcha & CAPTCHA_REGISTER) { $smarty->assign('enabled_register_captcha', 1); $smarty->assign('rand', mt_rand()); } } else { include_once('includes/lib_passport.php'); if (!empty($_POST['act']) && $_POST['act'] == 'signin') { $captcha = intval($_CFG['captcha']); if (($captcha & CAPTCHA_LOGIN) && (!($captcha & CAPTCHA_LOGIN_FAIL) || (($captcha & CAPTCHA_LOGIN_FAIL) && $_SESSION['login_fail'] > 2)) && gd_version() > 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } /* 检查验证码 */ include_once('includes/cls_captcha.php'); $validator = new captcha(); $validator->session_word = 'captcha_login'; if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } } $_POST['password']=isset($_POST['password']) ? trim($_POST['password']) : ''; if ($user->login($_POST['username'], $_POST['password'],isset($_POST['remember']))) { update_user_info(); //更新用户信息 recalculate_price(); // 重新计算购物车中的商品价格 /* 检查购物车中是否有商品 没有商品则跳转到首页 */ $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "' "; if ($db->getOne($sql) > 0) { ecs_header("Location: flow.php?step=checkout\n"); } else { ecs_header("Location:index.php\n"); } exit; } else { $_SESSION['login_fail']++; show_message($_LANG['signin_failed'], '', 'flow.php?step=login'); } } elseif (!empty($_POST['act']) && $_POST['act'] == 'signup') { if ((intval($_CFG['captcha']) & CAPTCHA_REGISTER) && gd_version() > 0) { if (empty($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } /* 检查验证码 */ include_once('includes/cls_captcha.php'); $validator = new captcha(); if (!$validator->check_word($_POST['captcha'])) { show_message($_LANG['invalid_captcha']); } } if (register(trim($_POST['username']), trim($_POST['password']), trim($_POST['email']))) { /* 用户注册成功 */ ecs_header("Location: flow.php?step=consignee\n"); exit; } else { $err->show(); } } else { // TODO: 非法访问的处理 } } } else { ecs_header("Location: flow.php\n"); exit; } }
本文原创地址:https://www.ecshopok.com/article-168.html
版权所有 © 转载时必须以链接形式注明出处!
觉得本文对您有用,想收藏下来!方法很简单:请点击-〉
我们一直坚持白天工作、晚上熬夜更新资源,付出了巨大的精力和时间,其中的辛酸难以言述。
下一篇:ecshop支付宝付款出现错误代码ILLEGAL_PARTNER 上一篇:ECShop禁用数据表缓存提高网店访问速度
暂无评论,来发表一个吧