diff --git a/account/account.php b/account/account.php index b5155ee..86feae8 100644 --- a/account/account.php +++ b/account/account.php @@ -43,7 +43,17 @@ echo "
".$token['code']."
"; + ?> + + + + + diff --git a/account/login.php b/account/login.php index 4407df1..b7282d9 100644 --- a/account/login.php +++ b/account/login.php @@ -33,81 +33,13 @@ include "../ui/required.php"; include "../ui/nav.php"; - // Initialize the session - session_start(); - // Check if the user is already logged in, if yes then redirect him to welcome page if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){ - $success = "You're already logged in! No need to try this again"; - } - - if (isset($_POST['login'])) { - // Checking if Username is empty - if (empty(trim($_POST["username"]))) { - $error = "Who are you?"; - } else { - $username = trim($_POST["username"]); - } - - // Check if Password is empty - if (empty(trim($_POST["password"]))) { - $error = "Pls enter super duper secrete password"; - } else { - $password = trim($_POST["password"]); - } - - // Check if no errors occured - if (empty($error)) { - // Prepare so SQL doesnt get spooked - $sql = "SELECT id, username, password FROM users WHERE username = ?"; - - if ($stmt = mysqli_prepare($conn, $sql)) { - // Bind dis shit - mysqli_stmt_bind_param($stmt, "s", $param_username); - - // Set parameters - $param_username = $username; - - // Attempt to execute the prepared statement - if (mysqli_stmt_execute($stmt)) { - // Store result - mysqli_stmt_store_result($stmt); - - // Check if username exists, if yes then verify password - if (mysqli_stmt_num_rows($stmt) == 1) { - // Bind result variables - mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password); - if (mysqli_stmt_fetch($stmt)) { - if (password_verify($password, $hashed_password)) { - // Password is correct, so start a new session - session_start(); - - // Store data in session variables - $_SESSION["loggedin"] = true; - $_SESSION["id"] = $id; - $_SESSION["username"] = $username; - - // let the user know - $success = "Yupee! You are now logged in"; - header("Location:https://superdupersecteteuploadtest.fluffybean.gay/index.php?login=success"); - } else { - $error = "Username or Password sus, please try again :3"; - } - } - } else { - $error = "Username or Password sus, please try again :3"; - } - } else { - $error = "Sowwy, something went wrong on our end :c"; - } - - // Close statement - mysqli_stmt_close($stmt); - } - } - - // Close connection - mysqli_close($conn); + ?> + + @@ -115,15 +47,29 @@Passwords are important to keep safe. Don't tell anyone your password, not even Fluffy!