Check editor accounts.

A new editor needs a username and a password of at least 12 characters. A persistent login needs an unexpired key and an existing account. Removing an account revokes its persistent logins, and its sessions end.
This commit is contained in:
tim
2026-09-26 15:27:51 +02:00
parent 5d657d7e45
commit 3df88e0b4c
10 changed files with 217 additions and 16 deletions
+16
View File
@@ -36,6 +36,22 @@ function open_db($state) {
}
}
/*
* TRUE if an editor account named $username exists. A session or a
* persistent login of an editor whose account was removed ends with it.
*/
function editor_exists($username) {
global $db;
if (!is_string($username) || $username === '')
return FALSE;
$opened = open_db('open');
$result = $db->execute_query("SELECT username FROM editors WHERE username = ?", array($username)) or db_fail();
$row = $result->fetch_assoc();
if ($opened)
open_db('close');
return (bool)$row;
}
/*
* Stop the page after a database error. The details, with the file and
* line of the failed call, go to the PHP error log; the visitor only