mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-15 00:24:12 +03:00
Fix potential problem with some absent HTTP request headers
This commit is contained in:
parent
cd1e8adce3
commit
5a4d3d420f
@ -609,9 +609,11 @@ function visitor_from_request()
|
||||
*/
|
||||
function get_remote_host()
|
||||
{
|
||||
$ext_addr = $_SERVER['REMOTE_ADDR'];
|
||||
$ext_addr = isset($_SERVER['REMOTE_ADDR'])
|
||||
? $_SERVER['REMOTE_ADDR']
|
||||
: '';
|
||||
$has_proxy = isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
&& $_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR'];
|
||||
&& $_SERVER['HTTP_X_FORWARDED_FOR'] != $ext_addr;
|
||||
if ($has_proxy) {
|
||||
$ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'], 2);
|
||||
$ext_addr = (count($ips) > 1)
|
||||
|
@ -36,7 +36,9 @@ define('PAGINATION_LINKS_ON_PAGE', 5);
|
||||
*/
|
||||
function generate_pagination_link($page, $title)
|
||||
{
|
||||
$lnk = $_SERVER['REQUEST_URI'];
|
||||
$lnk = isset($_SERVER['REQUEST_URI'])
|
||||
? $_SERVER['REQUEST_URI']
|
||||
: '';
|
||||
$href = preg_replace("/\?page=\d+\&/", "?", preg_replace("/\&page=\d+/", "", $lnk));
|
||||
$href .= strstr($href, "?") ? "&page=$page" : "?page=$page";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user