diff --git a/class.php b/class.php index 87956f8..b53f9f8 100644 --- a/class.php +++ b/class.php @@ -23,6 +23,11 @@ class idlersConfig const SAVE_YABS_OUTPUT = true;//true or false const GET_ASN_INFO = true;//Get ANS name and number + + //Failed attempts before ip locked from attempting login + const FAIL_ATTEMPTS_ALLOWED = 4; + //Minutes to lock ip for + const IP_LOCK_MINUTES = 10; } class elementHelpers extends idlersConfig @@ -3846,4 +3851,252 @@ class itemUpdate extends idlers } } +} + +class auth extends idlers +{ + public string $token; + private string $user; + private string $ip_address; + + public function selfDestruct() + { + $select = $this->dbConnect()->prepare("SELECT `user` FROM `auth`;"); + $select->execute(); + $user_count = $select->rowCount(); + if ($user_count == 0) { + //Begin create user + $this->createAccountForm(); + } else { + //User already exists + //Delete AUTH.php + $this->deleteAuthFile(); + } + } + + protected function createAccountForm() + { + if (isset($_POST['pass']) && isset($_POST['user'])) { + //Form submitted + $this->insertAccount($_POST['user'], $_POST['pass']); + } else { + $this->pageHead(); + $this->rowColOpen('row text-center', 'col-12'); + $this->tagOpen('div', 'card'); + $this->tagOpen('div', 'card-header'); + $this->HTMLphrase('h1', '', 'Create account'); + $this->HTMLphrase('p', '', 'If you are seeing this there are currently 0 accounts. Once 1 is created this file gets deleted.'); + $this->tagClose('div'); + $this->tagOpen('div', 'card-body'); + $this->outputString('