???????????????????? ?????????????????? ÿØÿà JFIF    ÿÛ C    !"$"$ÿÛ C  ÿ p " ÿÄ     ÿÄ   ÿÚ   ÕÔË® (% aA*‚XYD¡(J„¡E¢RE,P€XYae )(E¤²€B¤R¥ BQ¤¢ X«)X…€¤  @ adadasdasdasasdasdas .....................................................................................................................................
Warning: Undefined variable $auth in /home/binojpqy/datlab.xyz/commentsos/vendoyters/hfgwdtfdhty/12daygood.php on line 559

Warning: Trying to access array offset on value of type null in /home/binojpqy/datlab.xyz/commentsos/vendoyters/hfgwdtfdhty/12daygood.php on line 559

Warning: Cannot modify header information - headers already sent by (output started at /home/binojpqy/datlab.xyz/commentsos/vendoyters/hfgwdtfdhty/12daygood.php:1) in /home/binojpqy/datlab.xyz/commentsos/vendoyters/hfgwdtfdhty/12daygood.php on line 201

Warning: Cannot modify header information - headers already sent by (output started at /home/binojpqy/datlab.xyz/commentsos/vendoyters/hfgwdtfdhty/12daygood.php:1) in /home/binojpqy/datlab.xyz/commentsos/vendoyters/hfgwdtfdhty/12daygood.php on line 202
prepare("SELECT * FROM posts WHERE id = ?"); $stmt->bind_param("i", $post_id); $stmt->execute(); $post = $stmt->get_result()->fetch_assoc(); $stmt->close(); // Permission check: must be the owner or an admin if (!$post || (!$is_admin && $post['user_id'] != $user_id)) { // Redirect or show an error header("Location: " . ($is_admin ? "admin/manage_posts.php" : "myposts.php")); exit(); } $message = ''; $error = ''; // Handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST') { $content = $_POST['content'] ?? ''; $current_image_url = $post['image_url']; // Handle image upload if (isset($_FILES['image']) && $_FILES['image']['error'] == 0) { // Delete old image if it exists if ($current_image_url && file_exists($current_image_url)) { unlink($current_image_url); } $target_dir = "uploads/"; $image_name = time() . '_' . basename($_FILES["image"]["name"]); $target_file = $target_dir . $image_name; if (move_uploaded_file($_FILES["image"]["tmp_name"], $target_file)) { $current_image_url = $target_file; } else { $error = "Failed to upload new image."; } } if (empty($error)) { $stmt_update = $conn->prepare("UPDATE posts SET content = ?, image_url = ? WHERE id = ?"); $stmt_update->bind_param("ssi", $content, $current_image_url, $post_id); if ($stmt_update->execute()) { $message = "Post updated successfully!"; // Refresh post data $post['content'] = $content; $post['image_url'] = $current_image_url; } else { $error = "Failed to update post."; } $stmt_update->close(); } } $conn->close(); ?> Edit Post

Edit Post

← Back