Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
✨ See noten-app/app#1
Browse files Browse the repository at this point in the history
  • Loading branch information
CuzImBisonratte committed Sep 22, 2023
1 parent 6019450 commit 87c178c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions login/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
if (mysqli_connect_errno()) exit("Error connecting to our database! Please try again later.");

// Check if account exists
if ($input_type == "email") $stmt = $con->prepare("SELECT id, displayname, password, email, account_version, rounding, sorting, gradesystem FROM " . $settings["database_tables"]["accounts"] . " WHERE email = ?");
else $stmt = $con->prepare("SELECT id, displayname, password, email, account_version, rounding, sorting, gradesystem FROM " . $settings["database_tables"]["accounts"] . " WHERE username = ?");
if ($input_type == "email") $stmt = $con->prepare("SELECT id, displayname, password, email, account_version, rounding, sorting, gradesystem, school_year FROM " . $settings["database_tables"]["accounts"] . " WHERE email = ?");
else $stmt = $con->prepare("SELECT id, displayname, password, email, account_version, rounding, sorting, gradesystem, school_year FROM " . $settings["database_tables"]["accounts"] . " WHERE username = ?");
$stmt->bind_param('s', $input["email_or_username"]);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows == 0) exit("Account not found!");
$stmt->bind_result($id, $displayname, $password_hash, $email, $account_version, $setting_rounding, $setting_sorting, $setting_system);
$stmt->bind_result($id, $displayname, $password_hash, $email, $account_version, $setting_rounding, $setting_sorting, $setting_system, $school_year);
$stmt->fetch();

// Add salt and password and check if right
Expand All @@ -47,6 +47,7 @@
$_SESSION["setting_rounding"] = $setting_rounding;
$_SESSION["setting_sorting"] = $setting_sorting;
$_SESSION["setting_system"] = $setting_system;
$_SESSION["setting_year"] = $school_year;
$_SESSION["beta_tester"] = $beta_tester;

header("Location: https://beta.noten-app.de");

0 comments on commit 87c178c

Please sign in to comment.