summaryrefslogtreecommitdiff
path: root/libs/music/player.d/plistcreator.php
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2019-02-10 11:16:07 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-02-10 11:16:07 +0800
commit9d3c8c0e6e1a7ba43bf3dc19350d1dca68b657a3 (patch)
tree339de0698c13e1763d3361d70fb1266621025c91 /libs/music/player.d/plistcreator.php
downloadweb-9d3c8c0e6e1a7ba43bf3dc19350d1dca68b657a3.tar.xz
Initial commit.
Diffstat (limited to 'libs/music/player.d/plistcreator.php')
-rw-r--r--libs/music/player.d/plistcreator.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/music/player.d/plistcreator.php b/libs/music/player.d/plistcreator.php
new file mode 100644
index 0000000..b4f12c7
--- /dev/null
+++ b/libs/music/player.d/plistcreator.php
@@ -0,0 +1,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>