Compare commits
No commits in common. "f94a1ebbd551e917e5a7c968fe97446466a9599b" and "b814885a96c2f4d12c11a9f2420ecd3edca1a922" have entirely different histories.
f94a1ebbd5
...
b814885a96
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "report/AUThReport"]
|
|
||||||
path = report/AUThReport
|
|
||||||
url = ssh://git@git.hoo2.net:222/hoo2/AUThReport.git
|
|
||||||
@ -26,22 +26,16 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
// }
|
// }
|
||||||
require_once __DIR__ . "/config.php";
|
require_once __DIR__ . "/config.php";
|
||||||
|
|
||||||
// SQL injection mitigation: use a prepared statement with bound parameters.
|
// xxx' OR 1=1; -- '
|
||||||
// User input is treated strictly as data, not as part of the SQL syntax.
|
$sql_query = "SELECT * FROM login_users WHERE username='{$username}' AND password='{$password}';";
|
||||||
$stmt = $conn->prepare("SELECT id FROM login_users WHERE username = ? AND password = ?");
|
//echo $sql_query;
|
||||||
|
|
||||||
if ($stmt === false) {
|
// Check if the credentials are valid
|
||||||
// Fail closed (do not leak details in production).
|
$result = $conn->query($sql_query);
|
||||||
die("Prepare failed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->bind_param("ss", $username, $password);
|
|
||||||
$stmt->execute();
|
|
||||||
$stmt->store_result(); // Needed to use $stmt->num_rows
|
|
||||||
unset($_POST['username']);
|
unset($_POST['username']);
|
||||||
unset($_POST['password']);
|
unset($_POST['password']);
|
||||||
|
|
||||||
if ($stmt->num_rows >= 1) {
|
if (!empty($result) && $result->num_rows >= 1) {
|
||||||
// Regenerate session ID to prevent session fixation!
|
// Regenerate session ID to prevent session fixation!
|
||||||
//session_regenerate_id(true);
|
//session_regenerate_id(true);
|
||||||
|
|
||||||
@ -54,8 +48,8 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
// $_SESSION['user_id'] = $row['id'];
|
// $_SESSION['user_id'] = $row['id'];
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// Close
|
// Free result set
|
||||||
$stmt->close();
|
$result -> free_result();
|
||||||
$conn -> close();
|
$conn -> close();
|
||||||
|
|
||||||
// Redirect to a dashboard page
|
// Redirect to a dashboard page
|
||||||
@ -64,7 +58,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
} else {
|
} else {
|
||||||
$login_message = "Invalid username or password";
|
$login_message = "Invalid username or password";
|
||||||
}
|
}
|
||||||
$stmt->close();
|
|
||||||
$conn -> close();
|
$conn -> close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
report/.gitignore
vendored
6
report/.gitignore
vendored
@ -1,6 +0,0 @@
|
|||||||
# Report related files
|
|
||||||
*.aux
|
|
||||||
*.out
|
|
||||||
*.log
|
|
||||||
*.synctex.gz
|
|
||||||
_minted-report/*
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Subproject commit 74ec4b5f6c66382e5f1b6d2e6930897e4ed53ea6
|
|
||||||
Loading…
x
Reference in New Issue
Block a user