Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

publish_podcast.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. require_once('../includes/config.php');
  3. $userID = 0;
  4. $authorID = 0;
  5. $title = "";
  6. $post = "";
  7. //check to see that the form has been submitted
  8. if(isset($_POST))
  9. {
  10. //retrieve the $_POST variables
  11. $title = rawurldecode($_POST['title']);
  12. $post = rawurldecode($_POST['post']);
  13. $file = rawurldecode($_POST['file']);
  14. //initialize variables for form validation
  15. $success = true;
  16. if($success && !$logged_in)
  17. {
  18. $error = "You must be logged in to create a podcast.";
  19. $success = false;
  20. }
  21. if($success && empty($title))
  22. {
  23. $error = "You need to submit a title with your podcast.";
  24. $success = false;
  25. }
  26. if($success && strlen($title) > 140)
  27. {
  28. $error = "The maximum length for your title is 140 characters.";
  29. $success = false;
  30. }
  31. if($success && empty($post))
  32. {
  33. $error = "You need to submit an actual description for the podcast.";
  34. $success = false;
  35. }
  36. if($success && empty($file))
  37. {
  38. $error = "You need to upload a file for the podcast.";
  39. $success = false;
  40. }
  41. if($success && !$user->admin)
  42. {
  43. $error = "You are not allowed to post to this podcast.";
  44. $success = false;
  45. }
  46. if($success)
  47. {
  48. mkdir($CONF['podcast_dir'].$title, 0777, true);
  49. $files = explode(',', $file);
  50. foreach ($files as $single)
  51. {
  52. rename($CONF['podcast_dir'].$single, $CONF['podcast_dir'].$title.'/'.$single);
  53. }
  54. $data = array(
  55. "title" => $title,
  56. "tags" => "",
  57. "description" => $post,
  58. "file_name" => $file,
  59. "date_posted" => date("Y-m-d H:i:s",time())
  60. );
  61. $post_id = $db->insert($data, 'podcast');
  62. unset($_POST);
  63. echo "true";
  64. }
  65. else
  66. {
  67. unset($_POST);
  68. echo $error;
  69. }
  70. }
  71. else
  72. {
  73. echo "$_POST is not set.";
  74. }
  75. ?>