diff --git a/STARTGIT.bat b/STARTGIT.bat new file mode 100644 index 0000000..b4cac09 --- /dev/null +++ b/STARTGIT.bat @@ -0,0 +1 @@ +@cmd \ No newline at end of file diff --git a/core/classes.php b/core/classes.php index edc9dc9..49f00eb 100644 --- a/core/classes.php +++ b/core/classes.php @@ -13,12 +13,12 @@ class PartyStarter { echo ' '; } - function db() { - $db = new \PDO('mysql:dbname=undefined;host=127.0.0.1;charset=utf8mb4', 'root', ''); - $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); - $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } + +// Contributed by qzip! remove if noob. + } ?> \ No newline at end of file diff --git a/core/config.php b/core/config.php new file mode 100644 index 0000000..e0fa65b --- /dev/null +++ b/core/config.php @@ -0,0 +1,8 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); + } + catch (PDOException $e) { + echo "Connection failed: " . $e->getMessage(); + } diff --git a/register.php b/register.php index 99b1bbc..e64fa55 100644 --- a/register.php +++ b/register.php @@ -1,12 +1,12 @@ buildloggedoutheader(); -$passwordconfirmiswrong = "false"; +$passwordconfirmiswrong = false; +$passwordistooshort = false; if(isset($_POST['submit'])) { $username = $_POST['username']; $password = $_POST['pass']; @@ -16,43 +16,42 @@ if(isset($_POST['submit'])) { echo "ur password: " . $password; echo "
"; echo "ur passwordconfirm: " . $passwordconfirm; + echo "
"; if ($password == $passwordconfirm) { - echo ''; - echo "confirm pass is correct"; - if (strlen($password) < 8) { - $passwordistooshort = "true"; - } - if (strlen($password) > 8) { - $passwordistooshort = "false"; - } - if ($passwordistooshort == "false") { - $hashed = password_hash($password, PASSWORD_DEFAULT); - echo $hashed; - $getitstarted->db(); - $checkusername = $db->prepare('SELECT * FROM users WHERE username=(username) VALUES (:username)'); - $checkusername->execute([ 'username' => $username ]); - if (mysqli_num_rows($checkusername) > 0) { - echo "bruh momento"; - }else if(mysqli_num_rows($checkusername) < 0){ - echo "hello romania"; - } - } + $passwordconfirmiswrong = false; } else { - $passwordconfirmiswrong = "true"; - echo ''; + $passwordconfirmiswrong = true; + } + + if (strlen($password) < 8) { + $passwordistooshort = true; + } else { + $passwordistooshort = false; + } + if ($passwordistooshort == false && $passwordconfirmiswrong == false) { + $password = password_hash($password, PASSWORD_DEFAULT); + echo $password; + echo "
"; + $query = $con->prepare('SELECT COUNT(*) FROM users WHERE username=:username'); + $query->bindParam(':username', $username); + $query->execute(); + $result = $query->fetchColumn(); + if ($result == 0) { + echo "No results, continue. "; + $query = $con->prepare('INSERT INTO users (username, password) VALUES (:username, :password)'); + $query->bindParam(':username', $username); + $query->bindParam(':password', $password); + $query->execute(); + } else { + echo "Nope, you stay."; + } + } } $result = file_get_contents("https://useless-facts.sameerkumar.website/api"); $thefunfact = json_decode($result); ?> +
@@ -62,14 +61,14 @@ $thefunfact = json_decode($result); - " type="password" placeholder="Your password (Minmum 8 characters)" id="inputSmall" name="pass"> - Password Confirmation field is invalid.
'; - } else if ($passwordistooshort == "true") { + } else if ($passwordistooshort == true) { echo '
Password is too short. (8 Characters minmum)
'; }?> @@ -84,3 +83,4 @@ echo "form-control form-control-sm";

{"data"}; ?>

+ diff --git a/sex.php b/sex.php new file mode 100644 index 0000000..147cebc --- /dev/null +++ b/sex.php @@ -0,0 +1 @@ +