diff --git a/index.php b/index.php index c7a95bc..10866f8 100644 --- a/index.php +++ b/index.php @@ -132,6 +132,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $p_code = trim(htmlspecialchars($_POST['format'])); $p_expiry = trim(htmlspecialchars($_POST['paste_expire_date'])); $p_password = $_POST['pass']; + $tag_input = $_POST['tag_input']; if (empty($p_password)) { $p_password = null; @@ -139,13 +140,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $p_password = password_hash($p_password, PASSWORD_DEFAULT); } - $p_encrypt = $_POST['encrypted'] === '1'; - - $tag_input = $_POST['tag_input']; - - if ($p_encrypt) { + $p_encrypt = $_POST['encrypted']; + if ($p_encrypt == "" || $p_encrypt == null) { + $p_encrypt = "0"; + } else { + // Encrypt option + $p_encrypt = "1"; $p_content = openssl_encrypt($p_content, PP_ENCRYPTION_ALGO, PP_ENCRYPTION_KEY); - } + } // Set expiry time $expires = calculatePasteExpiry($p_expiry); diff --git a/paste.php b/paste.php index 5cf7a42..6d4df02 100644 --- a/paste.php +++ b/paste.php @@ -57,13 +57,9 @@ $row = $conn->querySelectOne( // This is used in the theme files. $totalpastes = getSiteTotalPastes($conn); -$notfound = null; -$is_private = false; - -if ($row === null) { +if (!$row) { header('HTTP/1.1 404 Not Found'); $notfound = $lang['notfound']; // "Not found"; - goto Not_Valid_Paste; } else { $paste_title = $row['title']; $paste_code = $row['code']; @@ -105,7 +101,7 @@ if ($row === null) { } } - if ($p_encrypt) { + if ($p_encrypt == 1) { $p_content = openssl_decrypt($p_content, PP_ENCRYPTION_ALGO, PP_ENCRYPTION_KEY); } @@ -260,7 +256,7 @@ if ($p_password == "NONE" || $p_password === null) { Not_Valid_Paste: // Private paste not valid -if ($is_private || $notfound) { +if ($is_private == '1') { // Display errors require_once('theme/' . $default_theme . '/header.php'); require_once('theme/' . $default_theme . '/errors.php');