discuz、ecshop、帝国cms部署https(ssl)后会员无法登录

discuz、ecshop、帝国cms部署https(ssl)后会员无法登录

注意,以下教程特网科技虚拟主机或者亚数的云主机独立IP部署SSL后的301跳转

1.discuz部署https后台无法登录:

discuz采用: _SERVER\['HTTPS'\] 方式判断,我司虚拟主机不支持同时也不支持_SERVER['HTTP_HOST'],需使用$_SERVER['HTTP_FROM_HTTPS']进行判断,其他php程序同样适用。

source/class/discuz/discuz_application.php (第188行左右):

查找:

_G\['isHTTPS'\] = (_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off') ? true : false;

修改为:

_G\['isHTTPS'\] = (_SERVER['HTTP_FROM_HTTPS'] && strtolower($_SERVER['HTTP_FROM_HTTPS']) != 'off') ? true : false;

uc_server/avatar.php(第14行左右):

查找:

define('UC_API', strtolower((_SERVER\['HTTPS'\] == 'on' ? 'https' : 'http').'://'._SERVER['HTTP_HOST'].substr(_SERVER\['PHP_SELF'\], 0, strrpos(_SERVER['PHP_SELF'], '/'))));

修改为:

define('UC_API', strtolower((_SERVER\['SERVER_PORT'\] == 443 \|\| _SERVER['HTTP_FROM_HTTPS'] == 'on' ? 'https' : 'http').'://'._SERVER\['HTTP_HOST'\].substr(_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))));

另:使用301方式强制将http跳转到https后会导致后台uc通信失败。

2.ecshop部署https后台无法登录:

打开includes/cls_ecshop.php 154行左右

查找

return (isset(_SERVER\['HTTPS'\]) \&\& (strtolower(_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';

修改为:

return isset(_SERVER\['HTTPS'\]) \&\& (strtolower(_SERVER['HTTPS']) != 'off')||(strtolower($_SERVER['HTTP_FROM_HTTPS']) == 'on') ? 'https://' : 'http://';

3.帝国cms部署https后台登陆空白:

(1)帝国cms7.2及以下版本

e/class/connect.php

function eReturnDomain(){

domain=RepPostStr(_SERVER['HTTP_HOST'],1);

if(emptyempty($domain))

{

return '';

}

// return 'http://'.$domain; 注释该行,替换成下两行内容

httptype = isset(_SERVER['HTTPS']) && (strtolower(_SERVER\['HTTPS'\]) != 'off')\|\|(strtolower(_SERVER['HTTP_FROM_HTTPS']) == 'on') ? 'https://' : 'http://';

return httptype.domain;

}

function FWeReturnDomain(){

domain=RepPostStr(_SERVER['HTTP_HOST'],1);

if(emptyempty($domain))

{

return '';

}

//return 'http://'.$domain; 注释该行,替换成下两行内容

httptype = isset(_SERVER['HTTPS']) && (strtolower(_SERVER\['HTTPS'\]) != 'off')\|\|(strtolower(_SERVER['HTTP_FROM_HTTPS']) == 'on') ? 'https://' : 'http://';

return httptype.domain;

}

(2)帝国cms7.5及以上版本

e/config/config.php 'httptype'=>0 # 全自动

e/class/connect.php

function eCheckUseHttps(){

//if(_SERVER\['HTTPS'\]\&\&strtolower(_SERVER['HTTPS'])!='off') 注释该行, 替换成下一行内容

if (isset(_SERVER\['HTTPS'\]) \&\& (strtolower(_SERVER['HTTPS']) != 'off')||(strtolower($_SERVER['HTTP_FROM_HTTPS']) == 'on'))

{

return 1;

}

else

{

return 0;

}

}

相关推荐
pengyi8710151 小时前
HTTP代理抓包核心原理,全面读懂请求与响应数据逻辑
网络·网络协议·http
小辰记事本1 小时前
从零读懂网卡内部架构:一条数据包的硬件之旅
网络·网络协议·架构·rdma
yqcoder3 小时前
HTTP 进化论:从“单车道土路”到“磁悬浮列车”
网络·网络协议·http
发光小北3 小时前
Profinet 转 Profibus DP 主站网关如何应用?
网络协议
跨境牛马哥3 小时前
2026爬虫开发:Playwright对决Puppeteer
大数据·网络·网络协议
HMS工业网络3 小时前
使用电脑快速测试DeviceNet设备通讯
网络协议·通讯协议·devicenet·设备通讯
Ether IC Verifier4 小时前
TCP滑动窗口与流量控制详解
网络·网络协议·tcp/ip
明月(Alioo)4 小时前
macOS 上 Charles 代理 HTTPS 抓包失败问题完整解决方案
网络协议·macos·https
pengyi8710154 小时前
HTTP代理抓包实操教程,零基础监控IP请求与响应数据
网络协议·tcp/ip·http
.千余4 小时前
【Linux】Socket编程UDP
linux·运维·服务器·开发语言·网络协议·学习·udp