我们希望访问ECSHOP网站首页的时候,要求必须登录,登录成功后才能正常显示首页。下面是ECSHOP网站开发中心分享的实现方法:
第一步:打开index.php文件
查找:
require(dirname(__FILE__) . '/includes/init.php');
在下面添加一行:
if($_SESSION['user_id']<1){Header("Location: user.php");}
第二步:打开 user.php
查找:约300行
show_message($_LANG['login_success'] . $ucdata , array($_LANG['back_up_page'], $_LANG['profile_lnk']), array($back_act,'user.php'), 'info');
修改为:
show_message($_LANG['login_success'] . $ucdata , array('返回网站首页', $_LANG['profile_lnk']), array('index.php','user.php'), 'info');
OK了