Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

publish_post.php 949B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. require_once('../includes/config.php');
  3. //check to see that the form has been submitted
  4. $id = 0;
  5. if(isset($_POST) && $logged_in)
  6. {
  7. $id = rawurldecode($_POST['id']);
  8. $post = $db->select('blog', "id=? LIMIT 1", array($id));
  9. if ($post)
  10. {
  11. $success = true;
  12. $publish = $post['publish'];
  13. if ($success && !$user->admin && $post_select['author_id'] != $user->id)
  14. {
  15. $error = "You are not allowed to publish this post.";
  16. if (!$publish)
  17. {
  18. $error = "You are not allowed to unpublish this post.";
  19. }
  20. $success = false;
  21. }
  22. if ($success)
  23. {
  24. $data = array(
  25. "publish" => $publish
  26. );
  27. $post_id = $db->update($data, 'blog', 'id=?', array($id));
  28. unset($_POST);
  29. echo "true";
  30. }
  31. else
  32. {
  33. echo $error;
  34. }
  35. }
  36. else
  37. {
  38. echo "That blog post does not exist.";
  39. }
  40. }
  41. else
  42. {
  43. echo "You need to be logged in to delete this post.";
  44. }
  45. ?>