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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user