Please select To the mobile version | Continue to access the desktop computer version
| |
| | |

CodersClub

 Forgot password?
 Register
Search
View: 3953|Reply: 2
Collapse the left

815版本更新中checkrobot函数preg_match() 少了一个参数

[Copy link]
Post time: 2018-07-05 15:58
| Show all posts |Read mode
本帖最后由 AlanJia2017 于 2018-7-5 18:37 编辑

source\function\function_core.php中checkrobot函数
原本代码
  1. if(strpos($useragent, 'http://') === false && dstrpos($useragent, $kw_browsers)) return false;
Copy the Code
815版本更新后的代码
  1. if(preg_match('/https?:\/\//is') && dstrpos($useragent, $kw_browsers)) return false;
Copy the Code
preg_match少了一个参数。

正确的应该是这样 ?
  1. if(!preg_match('/https?:\/\//is',$useragent) && dstrpos($useragent, $kw_browsers)) return false;
Copy the Code
且,最好是做http的兼容,比如是这样子。
  1. if(!preg_match('/^(http:\/\/|https:\/\/).*$/',$useragent) && dstrpos($useragent, $kw_browsers)) return false;
Copy the Code
搜索引擎的UA有的还是留的http协议的。
比如百度的:
https://ziyuan.baidu.com/wiki/990

题外话想说的是,815更新的https细节修正似乎根本没有为http留下任何余地。不考虑兼容?自己的网站强制https没问题,但是第三方网站就不好说了。你确定所有第三方链接都100%是https协议的?


 Russia

Post time: 2018-07-05 20:22
| Show all posts
First of all look at rev.#821 where this bug is fixed.
In the second your concerns about https are vain,
because the regular expression preg_match('/https?:\/\//is',$useragent) means "http OR https"
 Author| Post time: 2018-07-06 10:53
| Show all posts
vot 2018-7-5 20:22
First of all look at rev.#821 where this bug is fixed.
In the second your concerns about https are v ...

谢大佬回复
闹笑话了
You have to log in before you can reply Login | Register

Points Rules

Archive|Mobile|Dark room|CodersClub

Top.Mail.Ru
Top.Mail.Ru

2024-03-29 18:45 GMT+3 , Processed in 0.039267 sec., 9 queries .

Powered by Discuz! X3.4 Release 20230520

© 2001-2024 Discuz! Team.

MultiLingual version, Rev. 4301, © codersclub.org

Quick Reply To Top Return to the list