blob: b4f12c709de99ad2a180b8a12a6cddf97baf9226 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<pre>
<?php
if(!isset($_POST["plistid"])){echo "E: invalid plistid.";exit();}
if(intval($_POST["plistid"])<0||intval($_POST["plistid"])>=100)
{echo "E: invalid plistid.";exit();}
if(intval($_POST["plistid"])<16&&strcmp($_SERVER["REMOTE_ADDR"],"127.0.0.1")!=0&&strcmp($_SERVER["REMOTE_ADDR"],"::1")!=0&&strpos($_SERVER["REMOTE_ADDR"],"192.168")!==0&&strpos($_SERVER["REMOTE_ADDR"],"10.42")!==0)
{echo "W: Protected play list. Doing nothing. " . $_SERVER["REMOTE_ADDR"];exit();}
$fn=sprintf("/var/www/html/libs/music/player.d/playlists/%s",$_POST["plistid"]);
$file=fopen($fn,"w");
fwrite($file,$_POST["plistname"]);fwrite($file,"\n");
for($i=0;$i<count($_POST["plist"]);++$i)
{
fwrite($file,$_POST["plist"][$i]);
if(ord($_POST["plist"][$i][strlen($_POST["plist"][$i])-1])!=10)
fwrite($file,"\n");
}
fclose($file);
echo "I: Playlist created successfully. <a href=\"../player/",$_POST["plistid"],"\">Play it now!</a>";
?>
</pre>
|