mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-21 21:48:42 +00:00
fix(UOJContext.php): fix the bug that "page expires" occurs when accessing by localhost (#41)
To support subdomain cookies, an extra "." is added to the domain when setting the cookies. However, this strategy fails on "localhost", because browsers do not recognize ".localhost". So I add a check for this so that "localhost" is used as the cookie domain in this case.
This commit is contained in:
parent
4ed05e6388
commit
9c21c957c9
@ -67,7 +67,7 @@ class UOJContext {
|
||||
$domain = UOJConfig::$data['web']['main']['host'];
|
||||
}
|
||||
$domain = array_shift(explode(':', $domain));
|
||||
if (validateIP($domain)) {
|
||||
if (validateIP($domain) || $domain === 'localhost') {
|
||||
$domain = '';
|
||||
} else {
|
||||
$domain = '.'.$domain;
|
||||
|
Loading…
Reference in New Issue
Block a user