From 013270c5326d535192879a0375406efec7e0eda3 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Wed, 7 Jul 2021 23:37:56 -0700 Subject: [PATCH] Fallback to visitor IP address when CloudFlare IP address header is missing Resolves #232. --- inc/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 1718dc7..7b92508 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -212,8 +212,8 @@ function deletePostImages($post) { function deletePost($id) { $id = intval($id); - $is_op = false; + $is_op = false; $parent = 0; $op = array(); $posts = postsInThreadByID($id, false); @@ -969,7 +969,7 @@ function stripMetadata($filename) { } function remoteAddress() { - if (TINYIB_CLOUDFLARE) { + if (TINYIB_CLOUDFLARE && isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { return $_SERVER['HTTP_CF_CONNECTING_IP']; } return $_SERVER['REMOTE_ADDR'];