Merge pull request #698 from wrongecho/fix-braces

Functions.php - IP checker - braces
This commit is contained in:
Johnny 2023-06-14 19:17:46 -04:00 committed by GitHub
commit 8a33a45d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -85,9 +85,10 @@ function getIP() {
} else { } else {
$ip = $_SERVER["HTTP_CF_CONNECTING_IP"] ?? $_SERVER['REMOTE_ADDR']; $ip = $_SERVER["HTTP_CF_CONNECTING_IP"] ?? $_SERVER['REMOTE_ADDR'];
} }
if (!filter_var($ip, FILTER_VALIDATE_IP)) if (!filter_var($ip, FILTER_VALIDATE_IP)) {
die("Potential Security Violation"); exit("Potential Security Violation");
}
return $ip; return $ip;
} }
@ -657,7 +658,7 @@ function sanitizeForEmail($data) {
function timeAgo($datetime) { function timeAgo($datetime) {
$time = strtotime($datetime); $time = strtotime($datetime);
$difference = time() - $time; $difference = time() - $time;
if ($difference < 1) { if ($difference < 1) {
return 'just now'; return 'just now';
} }
@ -670,7 +671,7 @@ function timeAgo($datetime) {
60 => 'minute', 60 => 'minute',
1 => 'second' 1 => 'second'
); );
foreach ($timeRules as $secs => $str) { foreach ($timeRules as $secs => $str) {
$div = $difference / $secs; $div = $difference / $secs;
if ($div >= 1) { if ($div >= 1) {