直接用parse_url会忽略端口,如果用户是非80端口会产生问题

This commit is contained in:
炯思 2014-07-11 09:32:34 +08:00
parent a7bcb93d75
commit cee9dbc41e

View File

@ -67,6 +67,7 @@ if (!empty($_GET) || !empty($_POST)) {
}
$parts = parse_url($_SERVER['HTTP_REFERER']);
if($parts['port'] != 80) $parts['host'] = "{$parts['host']}:{$parts['port']}";
if (empty($parts['host']) || $_SERVER['HTTP_HOST'] != $parts['host']) {
exit;
}