Compare commits
3 Commits
b814885a96
...
f94a1ebbd5
| Author | SHA1 | Date | |
|---|---|---|---|
| f94a1ebbd5 | |||
| 75f47a76b0 | |||
| 6a2ca8f2a4 |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "report/AUThReport"]
|
||||||
|
path = report/AUThReport
|
||||||
|
url = ssh://git@git.hoo2.net:222/hoo2/AUThReport.git
|
||||||
@ -26,16 +26,22 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
// }
|
// }
|
||||||
require_once __DIR__ . "/config.php";
|
require_once __DIR__ . "/config.php";
|
||||||
|
|
||||||
// xxx' OR 1=1; -- '
|
// SQL injection mitigation: use a prepared statement with bound parameters.
|
||||||
$sql_query = "SELECT * FROM login_users WHERE username='{$username}' AND password='{$password}';";
|
// User input is treated strictly as data, not as part of the SQL syntax.
|
||||||
//echo $sql_query;
|
$stmt = $conn->prepare("SELECT id FROM login_users WHERE username = ? AND password = ?");
|
||||||
|
|
||||||
// Check if the credentials are valid
|
if ($stmt === false) {
|
||||||
$result = $conn->query($sql_query);
|
// Fail closed (do not leak details in production).
|
||||||
|
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 (!empty($result) && $result->num_rows >= 1) {
|
if ($stmt->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);
|
||||||
|
|
||||||
@ -48,8 +54,8 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
// $_SESSION['user_id'] = $row['id'];
|
// $_SESSION['user_id'] = $row['id'];
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// Free result set
|
// Close
|
||||||
$result -> free_result();
|
$stmt->close();
|
||||||
$conn -> close();
|
$conn -> close();
|
||||||
|
|
||||||
// Redirect to a dashboard page
|
// Redirect to a dashboard page
|
||||||
@ -58,7 +64,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
Normal file
6
report/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Report related files
|
||||||
|
*.aux
|
||||||
|
*.out
|
||||||
|
*.log
|
||||||
|
*.synctex.gz
|
||||||
|
_minted-report/*
|
||||||
1
report/AUThReport
Submodule
1
report/AUThReport
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 74ec4b5f6c66382e5f1b6d2e6930897e4ed53ea6
|
||||||
Loading…
x
Reference in New Issue
Block a user