Hello everyone. Sorry for the bump but I got no replies last time I posted.
I figured I'd at least include something of value, so here is my code:
<?php
session_start();
if(isset($_SESSION['loggedin']) && $_SESSION['userlevel']>=1)
{
if(isset($_GET['file']))
{
$file = base64_decode($_GET['file']);
$filesrc = "/mp3/" . $file;
$filedest = "/var/www/html/temp/content.mp3";
if(!($read = fopen($filesrc, "rb")))
{
echo "Filesrc couldn't be opened..";
exit();
}
if(!($write = fopen($filedest, "wb")))
{
echo "Filedest couldn't be opened..";
exit();
}
if(!fwrite($write, fread($read, filesize($filesrc))))
{
echo "Couldn't copy MP3 to temp dir..";
exit();
}
header("Location: [url]http://www.mysite.com/temp/stream.m3u[/url]");
exit();
}
else
{
header("Location: login_success.php?nofile");
exit();
}
}
else
{
header("Location: login_success.php?noauth");
exit();
}
?>
Just for clarity; I'm tryin to find a way to remove the content.mp3 file when the stream is closed.
Thanks.