From d5401cef495a4e9f62384ae9edfd53da19c54245 Mon Sep 17 00:00:00 2001 From: aftercase <74765798+aftercase@users.noreply.github.com> Date: Sat, 17 Jul 2021 22:31:21 +0100 Subject: [PATCH] Fixed Guest posting. Need a Guest account within users with an id of 1 to work. Probably worth looking for a better way. --- index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.php b/index.php index 270309e..0ced6e9 100644 --- a/index.php +++ b/index.php @@ -206,7 +206,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $error = $lang['loginwarning']; //"You must be logged in to do that." } } else { + if ($current_user['id'] == NULL) { + $paste_owner = "1"; + }else{ $paste_owner = $current_user ? $current_user['id'] : null; + } $statement = $conn->prepare( "INSERT INTO pastes (title, content, visible, code, expiry, password, encrypt, user_id, created_at, ip, views, tagsys) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?, 0, ?)"