Match usernames and session keys with = instead of LIKE.
A username of "%" matched the first editor.
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ if (isset($_SESSION['editor'])) {
|
||||
open_db('open');
|
||||
|
||||
$username = (string)($_POST['username'] ?? '');
|
||||
$query = "SELECT * FROM $table WHERE username LIKE ? LIMIT 1";
|
||||
$query = "SELECT * FROM $table WHERE username = ? LIMIT 1";
|
||||
$getid = $db->execute_query($query, array($username)) or die("Query failed: ".$db->error);
|
||||
$row = $getid->fetch_assoc();
|
||||
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ function check_persistent_login() {
|
||||
$cookie_data = (string)$_COOKIE['PersistentAuth'];
|
||||
list($username, $key) = explode("|", $cookie_data, 2) + array('', '');
|
||||
|
||||
$query = "SELECT * FROM $table WHERE username LIKE ? LIMIT 1";
|
||||
$query = "SELECT * FROM $table WHERE username = ? LIMIT 1";
|
||||
$getid = $db->execute_query($query, array($username)) or die("Query failed: ".$db->error);
|
||||
$row = $getid->fetch_assoc();
|
||||
open_db('close');
|
||||
@@ -86,7 +86,7 @@ function delete_persistent_login() {
|
||||
list($username, $key) = explode("|", $cookie_data, 2) + array('', '');
|
||||
|
||||
// Remove this session key from the database
|
||||
$query = "DELETE FROM $table WHERE username LIKE ? AND session LIKE ?";
|
||||
$query = "DELETE FROM $table WHERE username = ? AND session = ?";
|
||||
$db->execute_query($query, array($username, $key)) or die("Query failed: ".$db->error);
|
||||
|
||||
// Reap old sessions
|
||||
|
||||
Reference in New Issue
Block a user