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.

86 lines
2.0 KiB

<?php
require_once('../includes/config.php');
$userID = 0;
$authorID = 0;
$title = "";
$post = "";
//check to see that the form has been submitted
if(isset($_POST))
{
//retrieve the $_POST variables
$title = rawurldecode($_POST['title']);
$post = rawurldecode($_POST['post']);
$file = rawurldecode($_POST['file']);
//initialize variables for form validation
$success = true;
if($success && !$logged_in)
{
$error = "You must be logged in to create a podcast.";
$success = false;
}
if($success && empty($title))
{
$error = "You need to submit a title with your podcast.";
$success = false;
}
if($success && strlen($title) > 140)
{
$error = "The maximum length for your title is 140 characters.";
$success = false;
}
if($success && empty($post))
{
$error = "You need to submit an actual description for the podcast.";
$success = false;
}
if($success && empty($file))
{
$error = "You need to upload a file for the podcast.";
$success = false;
}
if($success && !$user->admin)
{
$error = "You are not allowed to post to this podcast.";
$success = false;
}
if($success)
{
8 years ago
mkdir($_CONF['podcast_dir'].$title, 0777, true);
$files = explode(',', $file);
foreach ($files as $single)
{
rename($_CONF['podcast_dir'].$single, $_CONF['podcast_dir'].$title.'/'.$single);
}
$data = array(
"title" => $title,
"tags" => "",
"description" => $post,
"file_name" => $file,
"date_posted" => date("Y-m-d H:i:s",time())
);
$post_id = $db->insert($data, 'podcast');
unset($_POST);
echo "true";
}
else
{
unset($_POST);
echo $error;
}
}
else
{
echo "$_POST is not set.";
}
?>