From 9a68dbf7babf9fe93d5c0c61cb9a5efb0b55220e Mon Sep 17 00:00:00 2001 From: Astrologies Date: Wed, 1 Dec 2021 21:12:30 -0500 Subject: [PATCH] webcontextmanager IsIPRegistered --- globals/Dependencies/Web/WebContextManager.php | 12 ++++++++++++ globals/functions.php | 12 ------------ html/register.php | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/globals/Dependencies/Web/WebContextManager.php b/globals/Dependencies/Web/WebContextManager.php index dc465c4..d6e8efa 100644 --- a/globals/Dependencies/Web/WebContextManager.php +++ b/globals/Dependencies/Web/WebContextManager.php @@ -110,5 +110,17 @@ namespace Alphaland\Web { } return false; } + + public static function IsIpRegistered(string $ip) + { + $userip = $GLOBALS['pdo']->prepare('SELECT * FROM `users` WHERE ip = :ipaddy'); + $userip->bindParam(':ipaddy', $ip, PDO::PARAM_STR); + $userip->execute(); + if ($userip->rowCount() > 0) + { + return true; + } + return false; + } } } diff --git a/globals/functions.php b/globals/functions.php index fd9218c..786ed88 100644 --- a/globals/functions.php +++ b/globals/functions.php @@ -6820,16 +6820,4 @@ function adminPanelStats() { '; } -function isIPAssociatedWithAccount($ip) -{ - $userip = $GLOBALS['pdo']->prepare('SELECT * FROM `users` WHERE ip = :ipaddy'); - $userip->bindParam(':ipaddy', $ip, PDO::PARAM_STR); - $userip->execute(); - if ($userip->rowCount() > 0) - { - return true; - } - return false; -} - //end utility } diff --git a/html/register.php b/html/register.php index 23a9107..06fd6b3 100644 --- a/html/register.php +++ b/html/register.php @@ -81,7 +81,7 @@ else $ip = getIP(); - if (isIPAssociatedWithAccount($ip)) + if (WebContextManager::IsIpRegistered($ip)) { $error = "Please contact an Administrator if possible."; }