ecshop 本地测试登陆时为什么默认执行的是privilege.php而不是index.php
答案:3 悬赏:60 手机版
解决时间 2021-04-10 15:14
- 提问者网友:咪咪
- 2021-04-10 00:14
从代码中并没又找到ECSHOP有修改aphache配置的地方,那为什么在浏览器中打上localhost/ecshop/admin/之后就默认知性privilege.php?不是应该先执行index.php吗?而且index.php中也没有判断跳转privilege.php的语句啊
最佳答案
- 五星知识达人网友:逃夭
- 2021-04-10 00:45
肯定有的你看下admin/includes/init.php下这段代码。没登陆。肯定是跳转到登陆页面了
if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) &&
$_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'signin' &&
$_REQUEST['act'] != 'forget_pwd' && $_REQUEST['act'] != 'reset_pwd' && $_REQUEST['act'] != 'check_order')
{
if (!empty($_COOKIE['ECSCP']['admin_id']) && !empty($_COOKIE['ECSCP']['admin_pass']))
{
// 找到了cookie, 验证cookie信息
$sql = 'SELECt user_id, user_name, password, action_list, last_login ' .
' FROM ' .$ecs->table('admin_user') .
" WHERe user_id = '" . intval($_COOKIE['ECSCP']['admin_id']) . "'";
$row = $db->GetRow($sql);
if (!$row)
{
// 没有找到这个记录
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
else
{
// 检查密码是否正确
if (md5($row['password'] . $_CFG['hash_code']) == $_COOKIE['ECSCP']['admin_pass'])
{
!isset($row['last_time']) && $row['last_time'] = '';
set_admin_session($row['user_id'], $row['user_name'], $row['action_list'], $row['last_time']);
// 更新最后登录时间和IP
$db->query('UPDATE ' . $ecs->table('admin_user') .
" SET last_login = '" . gmtime() . "', last_ip = '" . real_ip() . "'" .
" WHERe user_id = '" . $_SESSION['admin_id'] . "'");
}
else
{
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
}
else
{
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) &&
$_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'signin' &&
$_REQUEST['act'] != 'forget_pwd' && $_REQUEST['act'] != 'reset_pwd' && $_REQUEST['act'] != 'check_order')
{
if (!empty($_COOKIE['ECSCP']['admin_id']) && !empty($_COOKIE['ECSCP']['admin_pass']))
{
// 找到了cookie, 验证cookie信息
$sql = 'SELECt user_id, user_name, password, action_list, last_login ' .
' FROM ' .$ecs->table('admin_user') .
" WHERe user_id = '" . intval($_COOKIE['ECSCP']['admin_id']) . "'";
$row = $db->GetRow($sql);
if (!$row)
{
// 没有找到这个记录
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
else
{
// 检查密码是否正确
if (md5($row['password'] . $_CFG['hash_code']) == $_COOKIE['ECSCP']['admin_pass'])
{
!isset($row['last_time']) && $row['last_time'] = '';
set_admin_session($row['user_id'], $row['user_name'], $row['action_list'], $row['last_time']);
// 更新最后登录时间和IP
$db->query('UPDATE ' . $ecs->table('admin_user') .
" SET last_login = '" . gmtime() . "', last_ip = '" . real_ip() . "'" .
" WHERe user_id = '" . $_SESSION['admin_id'] . "'");
}
else
{
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
}
else
{
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
全部回答
- 1楼网友:轻熟杀无赦
- 2021-04-10 02:55
其实是一样的
1. ecshop后台的首页地址有是 index.php。
2. 但是进去之后会跳转到privilege.php。
3. 如果你要修改首页部分的代码也可以看看 templates
4. 目录里 index.html.
- 2楼网友:杯酒困英雄
- 2021-04-10 02:06
肯定有的你看下admin/includes/init.php下这段代码。没登陆。肯定是跳转到登陆页面了
if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) &&
$_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'signin' &&
$_REQUEST['act'] != 'forget_pwd' && $_REQUEST['act'] != 'reset_pwd' && $_REQUEST['act'] != 'check_order')
{
if (!empty($_COOKIE['ECSCP']['admin_id']) && !empty($_COOKIE['ECSCP']['admin_pass']))
{
// 找到了cookie, 验证cookie信息
$sql = 'SELECt user_id, user_name, password, action_list, last_login ' .
' FROM ' .$ecs->table('admin_user') .
" WHERe user_id = '" . intval($_COOKIE['ECSCP']['admin_id']) . "'";
$row = $db->GetRow($sql);
if (!$row)
{
// 没有找到这个记录
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
else
{
// 检查密码是否正确
if (md5($row['password'] . $_CFG['hash_code']) == $_COOKIE['ECSCP']['admin_pass'])
{
!isset($row['last_time']) && $row['last_time'] = '';
set_admin_session($row['user_id'], $row['user_name'], $row['action_list'], $row['last_time']);
// 更新最后登录时间和IP
$db->query('UPDATE ' . $ecs->table('admin_user') .
" SET last_login = '" . gmtime() . "', last_ip = '" . real_ip() . "'" .
" WHERe user_id = '" . $_SESSION['admin_id'] . "'");
}
else
{
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
}
else
{
if (!empty($_REQUEST['is_ajax']))
{
make_json_error($_LANG['priv_error']);
}
else
{
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯