Fixed Guest posting.

Need a Guest account within users with an id of 1 to work. Probably worth looking for a better way.
This commit is contained in:
aftercase 2021-07-17 22:31:21 +01:00
parent 1c1b4e5f44
commit d5401cef49

View file

@ -206,7 +206,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$error = $lang['loginwarning']; //"You must be logged in to do that." $error = $lang['loginwarning']; //"You must be logged in to do that."
} }
} else { } else {
if ($current_user['id'] == NULL) {
$paste_owner = "1";
}else{
$paste_owner = $current_user ? $current_user['id'] : null; $paste_owner = $current_user ? $current_user['id'] : null;
}
$statement = $conn->prepare( $statement = $conn->prepare(
"INSERT INTO pastes (title, content, visible, code, expiry, password, encrypt, user_id, created_at, ip, views, tagsys) VALUES "INSERT INTO pastes (title, content, visible, code, expiry, password, encrypt, user_id, created_at, ip, views, tagsys) VALUES
(?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, 0, ?)" (?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, 0, ?)"