Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add files 2012 version Hagit status

  • Loading branch information...
commit e2500b6fd776fb42993071c173bcb54e8817e812 1 parent a49f7e9
@wenchiching authored
View
32 create_table.php
@@ -0,0 +1,32 @@
+<?php
+ require_once("DB_config.php");
+ require_once("DB_class.php");
+ $db = new DB();
+ $db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
+ //儲存每個 line latest build_num no used
+ $q = "CREATE TABLE mp3 (
+ id INT AUTO_INCREMENT,
+ filepath VARCHAR(256) NOT NULL,
+ filename VARCHAR(256) NOT NULL,
+ PRIMARY KEY (id)
+ )ENGINE=MyISAM";
+
+ //$db->query($q);
+ $q = "CREATE TABLE pond (
+ pid INT,
+ filename VARCHAR(256) NOT NULL,
+ level INT,
+ description VARCHAR(256) NOT NULL,
+ )ENGINE=MyISAM";
+ //$db->query($q);
+
+/*
+mysql -uroot -p
+CREATE DATABASE mp3;
+GRANT all ON mp3.* TO mp3 IDENTIFIED BY '密碼';
+UPDATE user SET password=password('新密碼') where user='mp3';
+exit;mysql -uats -p
+USE ats;
+ALTER TABLE tablename AUTO_INCREMENT=0
+*/
+?>
View
14 do.php
@@ -1,14 +0,0 @@
-<?php
-$dir = $_POST['dir_name'];
-$path = $_POST['path'];
-if( !@mkdir("./".$dir,0777) ){
- //錯誤;導回上一層
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: http://iwhiori.twbbs.org/mp3/index.php?path=$path&err_mkdir1=1");
-}
-else{
- //正確
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: http://iwhiori.twbbs.org/mp3/index.php?path=$path/$dir");
-}
-?>
View
11 get.php
@@ -1,11 +0,0 @@
-<?php
-$path = $_POST['path'];
-$num = count($_FILES["uploads"]["name"]);
-//echo "共上傳了{$num}個檔案<br/>\n";
-for($i = 0 ; $i < $num ; $i++){
- //echo "{$_FILES[uploads][name][$i]}<br/>\n";
- move_uploaded_file($_FILES[uploads][tmp_name][$i], "./".$path."/".$_FILES[uploads][name][$i]);
-}
-header("HTTP/1.1 301 Moved Permanently");
-header("Location: http://iwhiori.twbbs.org/mp3/index.php?path=$path");
-?>
View
112 index.php
@@ -1,56 +1,82 @@
-<html>
-<head>
-<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
-<title>電音大帝國 Beta</title>
-</head>
-<body>
<?php
-echo "<script type=\"text/javascript\" src=\"http://mediaplayer.yahoo.com/js\"></script><br>\n";
+putenv("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
+setlocale(LC_ALL, 'zh_TW.UTF8');
$path = $_GET['path'];
if( $path == NULL){
- $path = ".";
+ $path = ".";
}
-if( ereg("\.\.", $path) ){
- $path= ".";
+if( @ereg("\.\.", $path) ){
+ $path= ".";
}
-echo "path is $path<br>\n";
-if( @!chdir("$path") ){
- echo "error when chdir to $path<br>\n";
- $path= ".";
+SETCOOKIE("path", $path);
+$url = $_POST["url"];
+if(!empty($url)){
+ exec("set -x;cd ".$path.";/usr/local/bin/wrap.sh ".$url." 1 >> /tmp/mp3.log 2>&1");
+ header("Location: http://kawaiftp.twbbs.org/mp3/index.php?path=".$path);
+}
+$dir = $_POST["dir"];
+if(!empty($dir)){
+ mkdir("$path/$dir", 0755, true);
+ header("Location: http://kawaiftp.twbbs.org/mp3/index.php?path=".$path);
}
-$err_mkdir1 = $_GET['err_mkdir1'];
-if( $err_mkdir1 == 1 ){
- echo "<span style=\"color:red\">建立資料夾錯誤,名稱重複嗎?</span>\n";
+?>
+<html>
+<head>
+ <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
+ <script type="text/javascript" src="playlist.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <title>電音大帝國 Beta</title>
+</head>
+<body>
+<div>
+ <input id="play" type="button" value="Play" />
+ <input id="pause" type="button" value="Pause" />
+ <span id="duration"> </span>
+ <span id="songname"> </span>
+</div>
+<div>
+ Volume:
+ <input id="volume" type="range" min="0" max="10" value="10" />
+</div>
+<form target="#" method="POST">
+ <input type="text" name="url" />
+ <input type="submit" value="Youtube 音樂">
+</form>
+<form target="#" method="POST">
+ <input type="text" name="dir" />
+ <input type="submit" value="新增資料夾">
+</form>
+<?php
+echo "path is <span id=\"path\">$path</span>\n";
+echo "<a href=\"http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path."\">進入刪除模式</a><br/>";
+if( @!chdir("$path") ){
+ echo "error when chdir to $path<br>\n";
+ $path= ".";
}
-echo "<form action=\"do.php\" method=\"POST\">\n";
-echo " <input type=\"text\" name=\"dir_name\">\n";
-echo " <input type=\"hidden\" name=\"path\" value=$path>\n";
-echo " <input type=\"submit\" value=\"建立資料夾\">輸入要建立的資料夾名稱\n";
-echo "</form>";
-echo "<form action='get.php' method='post' enctype='multipart/form-data'>\n";
-echo " <input name='uploads[]' type=file multiple>\n";
-echo " <input type=\"hidden\" name=\"path\" value=$path>\n";
-echo " <input type='submit' value=\"上傳檔案\">\n";
-echo " <span style=\"color:red\">您可以一次選取多個檔案(Thanks to HTML5!)</span>\n";
-echo "</form>\n";
-exec("ls", $file);
+exec("/bin/ls", $file);
$end = strrpos($path, "/");
$upper_path = substr($path, 0, $end);
-echo "<a href=\"index.php?path=".urlencode("$upper_path")."\">上一層</a><br>\n";
+echo "<a href=\"index.php?path=".urlencode("$upper_path")."\">上一層</a>\n";
+echo "<br/>";
+$i = 0;
foreach( $file as $per_file ){
- $string = filetype("$per_file");
- if( $string == "file" && ereg(".mp3",$per_file) ){
- echo "<a href=\"$path/$per_file\">$per_file</a><br>\n";
- }
- elseif( $string == "file" && ereg(".MP3",$per_file) ){
- echo "<a href=\"$path/$per_file\">$per_file</a><br>\n";
- }
- elseif( $string == "file" && ereg(".Mp3",$per_file) ){
- echo "<a href=\"$path/$per_file\">$per_file</a><br>\n";
- }
- elseif($string == "dir"){
- echo "<a href=\"index.php?path=".urlencode("$path/$per_file")."\">$per_file</a><br>\n";
- }
+ $string = filetype("$per_file");
+ if( $string == "file" && @ereg(".ogg",$per_file) ){
+ echo "<a name=\"".$i."\" onclick=\"play('".htmlentities("$path/$per_file", ENT_QUOTES, "UTF-8")."');return false;\" href=\"".htmlentities("$path/$per_file", ENT_QUOTES, "UTF-8")."\">$per_file</a><br/>\n";
+ }
+ elseif( $string == "file" && @ereg(".MP3",$per_file) ){
+ echo "<a name=\"".$i."\" onclick=\"play('".htmlentities("$path/$per_file", ENT_QUOTES, "UTF-8")."','".$i."');return false;\" href=\"".htmlentities("$path/$per_file", ENT_QUOTES, "UTF-8")."\">$per_file</a><br/>\n";
+ }
+ elseif( $string == "file" && @ereg(".Mp3",$per_file) ){
+ echo "<a name=\"".$i."\" onclick=\"play('".htmlentities("$path/$per_file", ENT_QUOTES, "UTF-8")."','".$i."');return false;\" href=\"".htmlentities("$path/$per_file", ENT_QUOTES, "UTF-8")."\">$per_file</a><br/>\n";
+ }
+ elseif( $string == "file" && @ereg(".mp3",$per_file) ){
+ echo "<a name=\"".$i."\" onclick=\"play('".htmlentities("$path/$per_file", ENT_QUOTES, "UTF-8")."','".$i."');return false;\" href=\"".htmlentities("$path/$per_file", ENT_QUOTES, "UTF-8")."\">$per_file</a><br/>\n";
+ }
+ elseif($string == "dir"){
+ echo "<a href=\"index.php?path=".urlencode("$path/$per_file")."\">$per_file</a><br/>\n";
+ }
+ $i++;
}
?>
</body>
View
43 playlist.js
@@ -0,0 +1,43 @@
+window.onload = load;
+// Invoke new Audio object
+var audio = new Audio('12.Breaking/01 Spitfire.mp3');
+function load() {
+// Get the play button and append an audio play method to onclick
+var play = document.getElementById('play');
+play.addEventListener('click', function(){
+ audio.play();
+}, false);
+
+// Get the pause button and append an audio pause method to onclick
+var pause = document.getElementById('pause');
+pause.addEventListener('click', function(){
+ audio.pause();
+}, false);
+
+// Get the HTML5 range input element and append audio volume adjustment to onchange
+var volume = document.getElementById('volume');
+volume.addEventListener('change', function(){
+ audio.volume = parseFloat(this.value / 10);
+}, false);
+
+// Get where one are in playback and push the time to an element
+audio.addEventListener("timeupdate", function() {
+ var duration = document.getElementById('duration');
+ var s = parseInt(audio.currentTime % 60);
+ var m = parseInt((audio.currentTime / 60) % 60);
+ duration.innerHTML = m + 'min.' + s + 'sec';
+}, false);
+}
+var i = 1;
+function play(tt, i) {
+ audio.setAttribute("src", tt);
+ audio.addEventListener("ended", playnext);
+ var songname = document.getElementById('songname');
+ songname.innerHTML = "<font color=\"#6D7B8D\">"+$("a[name="+i.toString()+"]").text()+"</font>";
+ audio.play();
+}
+function playnext() {
+ i++;
+ //alert( $("a[name="+i.toString()+"]").attr("href") );
+ play( $("a[name="+i.toString()+"]").attr("href"), i);
+}
View
89 rmode.php
@@ -0,0 +1,89 @@
+<?php
+putenv("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
+setlocale(LC_ALL, 'zh_TW.UTF8');
+$path = $_GET['path'];
+if( $path == NULL){
+ $path = ".";
+}
+if( @ereg("\.\.", $path) ){
+ $path= ".";
+}
+SETCOOKIE("path", $path);
+$url = $_POST["url"];
+if(!empty($url)){
+ exec("set -x;cd ".$path.";/usr/local/bin/wrap.sh ".$url." >> /tmp/mp3.log 2>&1");
+ header("Location: http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path);
+}
+$dir = $_POST["dir"];
+if(!empty($dir)){
+ mkdir("$path/$dir", 0755, true);
+ header("Location: http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path);
+}
+$file = $_GET["file"];
+if(!empty($file)){
+ exec("set -x;cd ".$path.";/bin/rm -rf ".$file." >> /tmp/mp2.log 2>&1");
+ header("Location: http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path);
+}
+?>
+<html>
+<head>
+ <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
+ <script type="text/javascript" src="playlist.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <title>電音大帝國 Beta</title>
+</head>
+<body>
+<div>
+ <input id="play" type="button" value="Play" />
+ <input id="pause" type="button" value="Pause" />
+ <span id="duration"> </span>
+ <span id="songname"> </span>
+</div>
+<div>
+ Volume:
+ <input id="volume" type="range" min="0" max="10" value="10" />
+</div>
+<form target="#" method="POST">
+ <input type="text" name="url" />
+ <input type="submit" value="Youtube 音樂">
+</form>
+<form target="#" method="POST">
+ <input type="text" name="dir" />
+ <input type="submit" value="新增資料夾">
+</form>
+<?php
+echo "path is <span id=\"path\">$path</span>\n";
+echo "<a href=\"http://kawaiftp.twbbs.org/mp3/index.php?path=".$path."\">回到一般模式</a><br/>";
+if( @!chdir("$path") ){
+ echo "error when chdir to $path<br>\n";
+ $path= ".";
+}
+exec("/bin/ls", $file);
+$end = strrpos($path, "/");
+$upper_path = substr($path, 0, $end);
+echo "<a href=\"index.php?path=".urlencode("$upper_path")."\">上一層</a>\n";
+echo "<br/>";
+$i = 0;
+foreach( $file as $per_file ){
+ $string = filetype("$per_file");
+ if( $string == "file" && @ereg(".ogg",$per_file) ){
+ echo $per_file."<a href=\"http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path."&file=".$per_file."\"> delete</a><br/>\n";
+ }
+ elseif( $string == "file" && @ereg(".MP3",$per_file) ){
+ echo $per_file."<a href=\"http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path."&file=".$per_file."\"> delete</a><br/>\n";
+ }
+ elseif( $string == "file" && @ereg(".Mp3",$per_file) ){
+ echo $per_file."<a href=\"http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path."&file=".$per_file."\"> delete</a><br/>\n";
+ }
+ elseif( $string == "file" && @ereg(".mp3",$per_file) ){
+ echo $per_file."<a href=\"http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path."&file=".$per_file."\"> delete</a><br/>\n";
+ }
+ elseif($string == "dir"){
+ echo "<a href=\"rmode.php?path=".urlencode("$path/$per_file")."\">$per_file</a>\n";
+ echo "<a href=\"http://kawaiftp.twbbs.org/mp3/rmode.php?path=".$path."&file=".$per_file."\"> delete</a><br/>\n";
+ }
+ $i++;
+}
+?>
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.