Ignore request values that are not strings.

An array action or username no longer causes a PHP error.
This commit is contained in:
tim
2026-09-26 15:27:51 +02:00
parent be814a3ba5
commit 52f4855850
6 changed files with 27 additions and 4 deletions
+3 -2
View File
@@ -6,13 +6,14 @@ $denied = NULL;
$wait_minutes = 0;
$captcha_failed = FALSE;
$is_admin = NULL;
$login_name = is_string($_POST['username'] ?? NULL) ? $_POST['username'] : '';
if (isset($_SESSION['editor'])) {
session_write_close();
header("Location: /publish/edit");
return;
} else if (isset($_POST['login']) && !csrf_valid()) {
$denied = TRUE;
} else if (isset($_POST['login']) && ($wait = login_blocked_for((string)($_POST['username'] ?? ''))) > 0) {
} else if (isset($_POST['login']) && ($wait = login_blocked_for($login_name)) > 0) {
$denied = TRUE;
$wait_minutes = (int)ceil($wait / 60);
} else if (isset($_POST['login']) && !captcha_verify_response()) {
@@ -23,7 +24,7 @@ if (isset($_SESSION['editor'])) {
$table = "editors";
open_db('open');
$username = (string)($_POST['username'] ?? '');
$username = $login_name;
$query = "SELECT * FROM $table WHERE username = ? LIMIT 1";
$getid = $db->execute_query($query, array($username)) or db_fail();
$row = $getid->fetch_assoc();