diff options
author | chai <chaifix@163.com> | 2022-03-17 21:02:13 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-17 21:02:13 +0800 |
commit | 90483f6eb389f041e0dbd0fca8bb766edbc85910 (patch) | |
tree | 125e5d01012cbab1ada0546dc5b9771af573a9ea |
+init
138 files changed, 1141 insertions, 0 deletions
diff --git a/Doc/设计.xlsx b/Doc/设计.xlsx Binary files differnew file mode 100644 index 0000000..f80010f --- /dev/null +++ b/Doc/设计.xlsx diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..d75bc08 --- /dev/null +++ b/admin.php @@ -0,0 +1,69 @@ +<html> + +<head> +<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, target-densityDpi=device-dpi"> +<style type="text/css"> +#container { + margin:0 auto; + max-width: 500px; +} +form .title { + display:block; + font-size:0.8em; + margin-bottom: 3px; +} +form .section{ + margin-bottom: 10px; + padding: 5px; + background: #efefef; +} +form .text { + width: 100%; +} +</style> + +</head> + +<body> + <div id="container"> + +<?php require_once 'functions.php';?> +<?php require_once 'config.php';?> + +<?php require_once 'music.php';?> + +<h1 style="font-size:1.2em;display:block;color:#c5c5c5;" >Add Music</h1> + +<form action="new.php" method="post" enctype="multipart/form-data"> + <div class="section"> + <label class="title" for="musicFile" >file:</label> + <input type="file" name="musicFile"/> + </div> + <div class="section"> + <label class="title" for="coverImage" >cover:</label> + <input type="file" name="coverImage"/> + </div> + <div class="section"> + <label class="title" for="musicProj" >project:</label> + <input type="file" name="musicProj"/> + </div> + <div class="section"> + <label class="title" for="title" >title:</label> + <input class="text" type="text" name="title" /><br/> + </div> + <div class="section"> + <label class="title" for="tags" >tags (seprate with comma):</label> + <input class="text" type="text" name="tags" /><br/> + </div> + <div class="section"> + <label class="title" for="albums" >albums id (seprate with comma):</label> + <input class="text" type="text" name="albums" /><br/> + </div> + <input style="float:right" type="submit" value="Upload Music" name="submit"/> +</form> + + <div> + +</body> + +</html>
\ No newline at end of file diff --git a/booth.php b/booth.php new file mode 100644 index 0000000..8e62fdd --- /dev/null +++ b/booth.php @@ -0,0 +1,42 @@ +<html> + +<head> +<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, target-densityDpi=device-dpi"> +<link rel="stylesheet" href="./res/styles.css"> +<script src="./res/main.js"></script> +<script> +function getLocalTime(nS) { + return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' '); +} + +window.onload = function() { + var lbTime = document.getElementById("music_time"); + var timestamp = lbTime.getAttribute("timestamp") ; + lbTime.innerHTML = formatDate(timestamp); +} +</script> +</head> + +<body> +<div id="container"> + + <div id="music_player_container"> + + <?php + require_once 'music.php'; + require_once 'template.php'; + + $id = $_GET['id']; + $music = fetch_music_by_id($id); + if($music != null){ + html_music_player($music); + } + ?> + + </div> + + <div style="clear:both;"></div> +</div> +</body> + +</html> diff --git a/config.php b/config.php new file mode 100644 index 0000000..b7e0e27 --- /dev/null +++ b/config.php @@ -0,0 +1,27 @@ +<?php + +class Config +{ + // 数据库连接 + public static $servername = "localhost"; + public static $username = "wod_dba"; + public static $password = ""; + public static $db_name = "musik"; + + // 数据库表格 + public static $tb_album = "album"; + public static $tb_album_music = "album_music"; + public static $tb_music = "music"; + public static $tb_music_tag = "music_tag"; + public static $tb_tags = "tags"; + + // 文件上传目录 + public static $music_upload_dir = "./music"; + public static $cover_upload_dir = "./cover"; + public static $project_upload_dir = "./project"; + + // + public static $music_per_page = 42; +} + +?>
\ No newline at end of file diff --git a/connect.php b/connect.php new file mode 100644 index 0000000..8787da3 --- /dev/null +++ b/connect.php @@ -0,0 +1,27 @@ +<?php require_once 'config.php'?> + +<?php + +global $conn; + +function execute_sql($sql) { + global $conn; + if($conn == NULL){ + // 创建连接 + $conn = new mysqli(Config::$servername, Config::$username, Config::$password, Config::$db_name); + + // 检测连接 + if ($conn->connect_error) { + die("连接失败: " . $conn->connect_error); + return ; + } + } + return mysqli_query($conn, $sql); +} + +function get_last_insert_id() { + global $conn; + return mysqli_insert_id($conn); +} + +?>
\ No newline at end of file diff --git a/cover/1647402810_80_DiaNA.png b/cover/1647402810_80_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647402810_80_DiaNA.png diff --git a/cover/1647423361_260_asura.png b/cover/1647423361_260_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647423361_260_asura.png diff --git a/cover/1647423470_942_asura.png b/cover/1647423470_942_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647423470_942_asura.png diff --git a/cover/1647423477_381_asura.png b/cover/1647423477_381_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647423477_381_asura.png diff --git a/cover/1647424241_663_asura.png b/cover/1647424241_663_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647424241_663_asura.png diff --git a/cover/1647424278_504_asura.png b/cover/1647424278_504_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647424278_504_asura.png diff --git a/cover/1647424320_918_asura.png b/cover/1647424320_918_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647424320_918_asura.png diff --git a/cover/1647424477_932_asura.png b/cover/1647424477_932_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647424477_932_asura.png diff --git a/cover/1647424521_376_asura.png b/cover/1647424521_376_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647424521_376_asura.png diff --git a/cover/1647424640_245_asura.png b/cover/1647424640_245_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647424640_245_asura.png diff --git a/cover/1647425514_113_DiaNA.png b/cover/1647425514_113_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647425514_113_DiaNA.png diff --git a/cover/1647425587_838_DiaNA.png b/cover/1647425587_838_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647425587_838_DiaNA.png diff --git a/cover/1647425619_404_DiaNA.png b/cover/1647425619_404_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647425619_404_DiaNA.png diff --git a/cover/1647425642_351_DiaNA.png b/cover/1647425642_351_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647425642_351_DiaNA.png diff --git a/cover/1647425704_142_DiaNA.png b/cover/1647425704_142_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647425704_142_DiaNA.png diff --git a/cover/1647425925_711_DiaNA.png b/cover/1647425925_711_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647425925_711_DiaNA.png diff --git a/cover/1647426023_615_DiaNA.png b/cover/1647426023_615_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647426023_615_DiaNA.png diff --git a/cover/1647426048_887_DiaNA.png b/cover/1647426048_887_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647426048_887_DiaNA.png diff --git a/cover/1647426359_274_DiaNA.png b/cover/1647426359_274_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647426359_274_DiaNA.png diff --git a/cover/1647426416_448_DiaNA.png b/cover/1647426416_448_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647426416_448_DiaNA.png diff --git a/cover/1647426498_437_DiaNA.png b/cover/1647426498_437_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647426498_437_DiaNA.png diff --git a/cover/1647426578_449_DiaNA.png b/cover/1647426578_449_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647426578_449_DiaNA.png diff --git a/cover/1647426656_723_DiaNA.png b/cover/1647426656_723_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647426656_723_DiaNA.png diff --git a/cover/1647426750_197_DiaNA.png b/cover/1647426750_197_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647426750_197_DiaNA.png diff --git a/cover/1647427419_785_DiaNA.png b/cover/1647427419_785_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647427419_785_DiaNA.png diff --git a/cover/1647429400_844_DiaNA.png b/cover/1647429400_844_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647429400_844_DiaNA.png diff --git a/cover/1647429648_507_DiaNA.png b/cover/1647429648_507_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647429648_507_DiaNA.png diff --git a/cover/1647429800_453_DiaNA.png b/cover/1647429800_453_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/cover/1647429800_453_DiaNA.png diff --git a/cover/1647430269_502_asura.png b/cover/1647430269_502_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647430269_502_asura.png diff --git a/cover/1647430349_300_asura.png b/cover/1647430349_300_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647430349_300_asura.png diff --git a/cover/1647430389_520_asura.png b/cover/1647430389_520_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/cover/1647430389_520_asura.png diff --git a/cover/1647478207_827_fl.png b/cover/1647478207_827_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/cover/1647478207_827_fl.png diff --git a/cover/1647478320_665_circle.png b/cover/1647478320_665_circle.png Binary files differnew file mode 100644 index 0000000..22c352c --- /dev/null +++ b/cover/1647478320_665_circle.png diff --git a/cover/1647478399_415_logo.png b/cover/1647478399_415_logo.png Binary files differnew file mode 100644 index 0000000..1fc60ea --- /dev/null +++ b/cover/1647478399_415_logo.png diff --git a/cover/1647478460_758_gamelab_small3.png b/cover/1647478460_758_gamelab_small3.png Binary files differnew file mode 100644 index 0000000..ff0a1b5 --- /dev/null +++ b/cover/1647478460_758_gamelab_small3.png diff --git a/cover/1647478629_10_twitter.png b/cover/1647478629_10_twitter.png Binary files differnew file mode 100644 index 0000000..28cff0f --- /dev/null +++ b/cover/1647478629_10_twitter.png diff --git a/cover/1647478665_713_gamelab2.png b/cover/1647478665_713_gamelab2.png Binary files differnew file mode 100644 index 0000000..d120451 --- /dev/null +++ b/cover/1647478665_713_gamelab2.png diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..8a7824b --- /dev/null +++ b/functions.php @@ -0,0 +1,29 @@ +<?php + + +function echoln($content){ + if($content === true){ + $content = "true"; + } + if($content === false){ + $content = "false"; + } + echo $content; + echo "<br/>"; +} + +function println($content) +{ + print_r($content); + echo "<br/>"; +} + +// 替换为html转义字符,否则插入sql会有问题 +function html_escape_string($str) { + $str = str_replace("'", "'", $str); // ' + $str = str_replace('"', """, $str); // " + return $str; +} + +?> + diff --git a/header.php b/header.php new file mode 100644 index 0000000..e4286e4 --- /dev/null +++ b/header.php @@ -0,0 +1,5 @@ +<div id="header"> + <a href="./index.php"><img id="dachai_logo" src="./res/dachai.png"/></a> + <label id="site_title">Dachai & Music<br/>Sound, BGM, Vocal, etc.</label> +</div> +<div style="clear:both;"></div>
\ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..d3118a6 --- /dev/null +++ b/index.php @@ -0,0 +1,21 @@ +<html> + +<head> +<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, target-densityDpi=device-dpi"> +<link rel="stylesheet" href="./res/styles.css"> +<script src="./res/main.js"></script> +</head> + +<body> +<div id="container"> + <?php include_once('header.php');?> + <?php include_once('titlebar.php');?> + <?php include_once('music.php');?> + <?php + $musiclist = fetch_range_music(); + ?> + <?php include('musiclist.php');?> +</div> +</body> + +</html>
\ No newline at end of file diff --git a/music.php b/music.php new file mode 100644 index 0000000..acd4165 --- /dev/null +++ b/music.php @@ -0,0 +1,370 @@ +<?php + +require_once 'config.php'; +require_once 'connect.php'; + +class Tag +{ + public $uid; + public $name; +} + +class Album +{ + public $uid; + public $name; +} + +class Music +{ + public $uid; // unique id + public $path; // 路径 + public $title; // 标题名 + public $time; // 创建时间 + public $cover; // 封面 + public $project; // 封面 + public $array_tags; // 标签名 + public $array_albums; // 从属的专辑 +} + +function fetch_tag_by_id($uid) +{ + $result = execute_sql("SELECT * FROM " . Config::$tb_tags . " where id=" . $uid); + while($row = mysqli_fetch_assoc($result)){ + $tag = new Tag; + $tag->uid = $uid; + $tag->name = $row['name']; + return $tag; + } + return null; +} + +function fetch_tag_by_name($name) +{ + $result = execute_sql("SELECT * FROM " . Config::$tb_tags . " where name='" . $name . "'"); + if($result == NULL || $result->num_rows == 0) + return null; + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $tag = new Tag; + $tag->uid = $row['id']; + $tag->name = $row['name']; + array_push($arr, $tag); + } + return $arr; +} + +function fetch_all_tags() { + $sql = "SELECT * FROM ". Config::$tb_tags; + $result = execute_sql($sql); + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $tag = new Tag; + $tag->uid = $row['id']; + $tag->name = $row['name']; + array_push($arr, $tag); + } + return $arr; +} + +function fetch_album_by_id($uid) +{ + $result = execute_sql("SELECT * FROM " . Config::$tb_album . " where id=" . $uid); + while($row = mysqli_fetch_assoc($result)){ + $album = new Album; + $album->uid = $uid; + $album->name = $row['name']; + return $album; + } + return null; +} + +function fetch_album_by_name($name) +{ + $result = execute_sql("SELECT * FROM " . Config::$tb_album . " where name='" . $name . "'"); + if($result == NULL || $result->num_rows == 0) + return null; + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $album = new Album; + $album->uid = $row['id']; + $album->name = $row['name']; + array_push($arr, $album); + } + return $arr; +} + +function insert_tag($name) +{ + execute_sql("INSERT INTO " . Config::$tb_tags . " (name) values('" . $name . "')"); +} + +function insert_album($name) +{ + execute_sql("INSERT INTO " . Config::$tb_album . " (name) values('" . $name . "')"); +} + +function add_unique_tag($name) { + $arr = fetch_tag_by_name($name); + if($arr == null || count($arr) == 0) { + insert_tag($name); + $arr = fetch_tag_by_name($name); + } + return $arr[0]; +} + +function add_unique_album($name) { + $arr = fetch_album_by_name($name); + if($arr == null || count($arr) == 0) { + insert_album($name); + $arr = fetch_album_by_name($name); + } + return $arr[0]; +} + +// 获得某个音乐的tags +function fetch_music_tags($uid) { + $sql = "SELECT * FROM " . Config::$tb_music_tag . ' WHERE music_id=' . $uid; + $result = execute_sql($sql); + if($result == NULL || $result->num_rows == 0) + return null; + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $tagId = $row['tag_id']; + $tag = fetch_tag_by_id($tagId); + array_push($arr, $tag); + } + return $arr; +} + +// 获得某个音乐从属的专辑 +function fetch_music_albums ($uid){ + $sql = "SELECT * FROM " . Config::$tb_album_music . ' WHERE music_id=' . $uid; + $result = execute_sql($sql); + if($result == NULL || $result->num_rows == 0) + return null; + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $albumId = $row['album_id']; + $album = fetch_album_by_id($albumId); + array_push($arr, $album); + } + return $arr; +} + +function fetch_music_by_id($uid) { + $sql = "SELECT * FROM " . Config::$tb_music . " WHERE id=" . $uid; + $result = execute_sql($sql); + if($result == NULL || $result->num_rows == 0) + { + return null; + } + while($row = mysqli_fetch_assoc($result)){ + $music = new Music(); + $music->uid = $row['id']; + $music->path = $row['path']; + $music->cover = $row['cover']; + $music->project = $row['project']; + $music->title = $row['title']; + $music->time = $row['time']; + $music->array_tags = fetch_music_tags($music->uid); + $music->array_albums = fetch_music_albums($music->uid); + return $music; + } +} + +// 从第from个记录开始的count个 +function fetch_range_music($from=0, $count=100) { + $sql = "SELECT id FROM " . Config::$tb_music . " ORDER BY time DESC LIMIT " . $from . ", " . $count ; + $result = execute_sql($sql); + if($result == NULL || $result->num_rows == 0) + { + return null; + } + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $id = $row['id']; + $music = fetch_music_by_id($id); + array_push($arr, $music); + } + + return $arr; +} + +//搜索 + +function fetch_musics_by_name($name, $from=0, $count=100) { + $sql = "SELECT id FROM " . Config::$tb_music . " WHERE title LIKE '%" . $name . "%' ORDER BY time DESC LIMIT " . $from . ", " . $count; + $result = execute_sql($sql); + if($result == null || $result->num_rows == 0) + return ; + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $music_id = $row['id']; + $music = fetch_music_by_id($music_id); + array_push($arr, $music); + } + return $arr; +} + +function fetch_musics_by_tag($tag_id, $from=0, $count=100) { + $sql = "SELECT music_id FROM " . Config::$tb_music_tag . " WHERE tag_id=" . $tag_id ;//. " ORDER BY time DESC LIMIT " . $from . ", " . $count; + $result = execute_sql($sql); + if($result == null || $result->num_rows == 0) + return ; + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $music_id = $row['music_id']; + $music = fetch_music_by_id($music_id); + array_push($arr, $music); + } + return $arr; +} + +function fetch_musics_by_album($album_id, $from=0, $count=100) { + $sql = "SELECT music_id FROM " . Config::$tb_album_music . " WHERE album_id=" . $album_id . " ORDER BY time DESC LIMIT " . $from . ", " . $count; + $result = execute_sql($sql); + if($result == null || $result->num_rows == 0) + return ; + $arr = array(); + while($row = mysqli_fetch_assoc($result)){ + $music_id = $row['music_id']; + $music = fetch_music_by_id($music_id); + array_push($arr, $music); + } + return $arr; +} + +function add_unique_music_tag( $music_id, $tag_id ) +{ + $result = execute_sql("SELECT * FROM " . Config::$tb_music_tag . " where music_id=" . $music_id . " and tag_id=" . $tag_id ); + if($result == NULL || $result->num_rows == 0) + { + execute_sql("INSERT INTO " . Config::$tb_music_tag . " (music_id, tag_id) values (" . $music_id . ", " . $tag_id . ")"); + } +} + +function add_unique_music_album( $music_id, $album_id ) +{ + $result = execute_sql("SELECT * FROM " . Config::$tb_album_music . " where music_id=" . $music_id . " and album_id=" . $album_id ); + if($result == NULL || $result->num_rows == 0) + { + execute_sql("INSERT INTO " . Config::$tb_album_music . " (music_id, album_id) values (" . $music_id . ", " . $album_id . ")"); + } +} + +function get_last_id() { + $result = execute_sql("select @@IDENTITY"); + while($row = mysqli_fetch_assoc($result)){ + println($row); + } +} + +// 提交上来的表单中构建music +function get_music_from_post() +{ + $music = new Music; + + $music_file = $_FILES["musicFile"]; + $cover_image = $_FILES["coverImage"]; + $music_proj = $_FILES["musicProj"]; + + if(is_upload_notempty($music_file)) { + $res_music = upload_file(Config::$music_upload_dir, $music_file); + if($res_music[0] == 0) + return null; + $music->path = $res_music[1]; + } + else // 必须有音乐文件 + { + return null; + } + + if(is_upload_notempty($cover_image)) { + $res_cover = upload_file(Config::$cover_upload_dir, $cover_image); + if($res_cover[0] == 0) + return null; + $music->cover = $res_cover[1]; + } + + if(is_upload_notempty($music_proj)) { + $res_proj = upload_file(Config::$project_upload_dir, $music_proj); + if($res_proj[0] == 0) + return null; + $music->project = $res_proj[1]; + } + + + if($_POST["tags"] != null && $_POST["tags"] != "") + $tags_name = explode(',', $_POST["tags"]); + + if($_POST["albums"] != null && $_POST["albums"] != "") + $albums_id = explode(',', $_POST["albums"]); + + $music->array_tags = array(); + if($tags_name != null && count($tags_name) > 0) { + foreach($tags_name as $tag_name){ + $tag = add_unique_tag($tag_name); + array_push($music->array_tags, $tag); + } + } + + $music->array_albums = array(); + if($albums_id != null && count($albums_id) > 0) { + foreach($albums_id as $album_id){ + $album = fetch_album_by_id($album_id); + if($album == null) + continue; + array_push($music->array_albums, $album); + } + } + + $music->time = time(); + + $music->title = html_escape_string($_POST["title"]); + + $music->uid = -1; // 未插入数据库 + + //println($music); + + return $music; +} + +// 将music写入数据库(插入或更新) +function write_music_to_db($music) { + if ($music == null ) + return ; + + if($music->uid == -1){// 插入新的 + + $sql = "INSERT INTO " . Config::$tb_music . " (path, title, time, cover, project) values (" . + "'". $music->path . "',". + "'". $music->title . "',". + $music->time . ",". + "'". $music->cover . "',". + "'". $music->project . "'". + ")" ; + //println($sql); + execute_sql($sql); + + $id = get_last_insert_id(); + + foreach($music->array_tags as $tag){ + add_unique_music_tag($id, $tag->uid); + } + + foreach($music->array_albums as $album){ + add_unique_music_album($id, $album->uid); + } + + } + else // 更新 + { + + + + } + +} + +?>
\ No newline at end of file diff --git a/music/1647422609_634_DiaNA.png b/music/1647422609_634_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647422609_634_DiaNA.png diff --git a/music/1647422872_636_DiaNA.png b/music/1647422872_636_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647422872_636_DiaNA.png diff --git a/music/1647422946_745_DiaNA.png b/music/1647422946_745_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647422946_745_DiaNA.png diff --git a/music/1647423110_620_DiaNA.png b/music/1647423110_620_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647423110_620_DiaNA.png diff --git a/music/1647423134_648_DiaNA.png b/music/1647423134_648_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647423134_648_DiaNA.png diff --git a/music/1647423201_504_DiaNA.png b/music/1647423201_504_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647423201_504_DiaNA.png diff --git a/music/1647423269_90_DiaNA.png b/music/1647423269_90_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647423269_90_DiaNA.png diff --git a/music/1647423295_862_DiaNA.png b/music/1647423295_862_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647423295_862_DiaNA.png diff --git a/music/1647423361_716_DiaNA.png b/music/1647423361_716_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647423361_716_DiaNA.png diff --git a/music/1647423470_95_DiaNA.png b/music/1647423470_95_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647423470_95_DiaNA.png diff --git a/music/1647423477_217_DiaNA.png b/music/1647423477_217_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647423477_217_DiaNA.png diff --git a/music/1647424241_250_DiaNA.png b/music/1647424241_250_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647424241_250_DiaNA.png diff --git a/music/1647424278_130_DiaNA.png b/music/1647424278_130_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647424278_130_DiaNA.png diff --git a/music/1647424320_639_DiaNA.png b/music/1647424320_639_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647424320_639_DiaNA.png diff --git a/music/1647424477_120_DiaNA.png b/music/1647424477_120_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647424477_120_DiaNA.png diff --git a/music/1647424521_437_DiaNA.png b/music/1647424521_437_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647424521_437_DiaNA.png diff --git a/music/1647424640_990_DiaNA.png b/music/1647424640_990_DiaNA.png Binary files differnew file mode 100644 index 0000000..5519484 --- /dev/null +++ b/music/1647424640_990_DiaNA.png diff --git a/music/1647425514_718_asura.png b/music/1647425514_718_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647425514_718_asura.png diff --git a/music/1647425587_527_asura.png b/music/1647425587_527_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647425587_527_asura.png diff --git a/music/1647425619_306_asura.png b/music/1647425619_306_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647425619_306_asura.png diff --git a/music/1647425642_404_asura.png b/music/1647425642_404_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647425642_404_asura.png diff --git a/music/1647425704_851_asura.png b/music/1647425704_851_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647425704_851_asura.png diff --git a/music/1647425925_450_asura.png b/music/1647425925_450_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647425925_450_asura.png diff --git a/music/1647426023_661_asura.png b/music/1647426023_661_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647426023_661_asura.png diff --git a/music/1647426048_158_asura.png b/music/1647426048_158_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647426048_158_asura.png diff --git a/music/1647426359_923_asura.png b/music/1647426359_923_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647426359_923_asura.png diff --git a/music/1647426416_184_asura.png b/music/1647426416_184_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647426416_184_asura.png diff --git a/music/1647426498_981_asura.png b/music/1647426498_981_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647426498_981_asura.png diff --git a/music/1647426578_270_asura.png b/music/1647426578_270_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647426578_270_asura.png diff --git a/music/1647426656_568_asura.png b/music/1647426656_568_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647426656_568_asura.png diff --git a/music/1647426750_678_asura.png b/music/1647426750_678_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647426750_678_asura.png diff --git a/music/1647427419_785_asura.png b/music/1647427419_785_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647427419_785_asura.png diff --git a/music/1647429400_241_asura.png b/music/1647429400_241_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647429400_241_asura.png diff --git a/music/1647429648_281_asura.png b/music/1647429648_281_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647429648_281_asura.png diff --git a/music/1647429800_324_asura.png b/music/1647429800_324_asura.png Binary files differnew file mode 100644 index 0000000..4809473 --- /dev/null +++ b/music/1647429800_324_asura.png diff --git a/music/1647430269_302_Y2Mate.is - Ein Jäger aus Kurpfalz ♞ [German march][instrumental]-doVpPxjbkTQ-160k-1647427146670.mp3 b/music/1647430269_302_Y2Mate.is - Ein Jäger aus Kurpfalz ♞ [German march][instrumental]-doVpPxjbkTQ-160k-1647427146670.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/music/1647430269_302_Y2Mate.is - Ein Jäger aus Kurpfalz ♞ [German march][instrumental]-doVpPxjbkTQ-160k-1647427146670.mp3 diff --git a/music/1647430349_734_germanfolk.mp3 b/music/1647430349_734_germanfolk.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/music/1647430349_734_germanfolk.mp3 diff --git a/music/1647430389_960_germanfolk.mp3 b/music/1647430389_960_germanfolk.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/music/1647430389_960_germanfolk.mp3 diff --git a/music/1647478207_737_germanfolk.mp3 b/music/1647478207_737_germanfolk.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/music/1647478207_737_germanfolk.mp3 diff --git a/music/1647478320_687_Erika.mp3 b/music/1647478320_687_Erika.mp3 Binary files differnew file mode 100644 index 0000000..e893114 --- /dev/null +++ b/music/1647478320_687_Erika.mp3 diff --git a/music/1647478399_478_Erika.mp3 b/music/1647478399_478_Erika.mp3 Binary files differnew file mode 100644 index 0000000..e893114 --- /dev/null +++ b/music/1647478399_478_Erika.mp3 diff --git a/music/1647478460_655_germanfolk.mp3 b/music/1647478460_655_germanfolk.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/music/1647478460_655_germanfolk.mp3 diff --git a/music/1647478629_695_germanfolk.mp3 b/music/1647478629_695_germanfolk.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/music/1647478629_695_germanfolk.mp3 diff --git a/music/1647478665_342_Erika.mp3 b/music/1647478665_342_Erika.mp3 Binary files differnew file mode 100644 index 0000000..e893114 --- /dev/null +++ b/music/1647478665_342_Erika.mp3 diff --git a/musiclist.php b/musiclist.php new file mode 100644 index 0000000..5cfaeed --- /dev/null +++ b/musiclist.php @@ -0,0 +1,19 @@ +<?php +// 需要调用者传入$musiclist +?> + +<div style="clear:both;"></div> +<div id="music_outer"> + <div id="music_inner"> + <div id="music_list"> + + <?php require_once 'template.php'?> + <?php + foreach($musiclist as $music){ + html_music($music); + } + ?> + + </div> + </div> +</div>
\ No newline at end of file @@ -0,0 +1,17 @@ +<?php require_once 'upload.php'; ?> +<?php require_once 'functions.php';?> +<?php require_once 'config.php';?> +<?php require_once 'music.php';?> + +<?php + +$music = get_music_from_post(); +if($music != null) { + write_music_to_db($music); +} + +// 跳转 +header('Location: '.'index.php'); + + +?>
\ No newline at end of file diff --git a/project/1647403468_42_Digital NewAges.png b/project/1647403468_42_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647403468_42_Digital NewAges.png diff --git a/project/1647423361_95_fl.png b/project/1647423361_95_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647423361_95_fl.png diff --git a/project/1647423470_657_fl.png b/project/1647423470_657_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647423470_657_fl.png diff --git a/project/1647423477_204_fl.png b/project/1647423477_204_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647423477_204_fl.png diff --git a/project/1647424241_614_fl.png b/project/1647424241_614_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647424241_614_fl.png diff --git a/project/1647424278_990_fl.png b/project/1647424278_990_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647424278_990_fl.png diff --git a/project/1647424320_861_fl.png b/project/1647424320_861_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647424320_861_fl.png diff --git a/project/1647424477_588_fl.png b/project/1647424477_588_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647424477_588_fl.png diff --git a/project/1647424521_549_fl.png b/project/1647424521_549_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647424521_549_fl.png diff --git a/project/1647424640_2_fl.png b/project/1647424640_2_fl.png Binary files differnew file mode 100644 index 0000000..acf6909 --- /dev/null +++ b/project/1647424640_2_fl.png diff --git a/project/1647425514_707_Digital NewAges.png b/project/1647425514_707_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647425514_707_Digital NewAges.png diff --git a/project/1647425587_519_Digital NewAges.png b/project/1647425587_519_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647425587_519_Digital NewAges.png diff --git a/project/1647425619_754_Digital NewAges.png b/project/1647425619_754_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647425619_754_Digital NewAges.png diff --git a/project/1647425642_306_Digital NewAges.png b/project/1647425642_306_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647425642_306_Digital NewAges.png diff --git a/project/1647425704_16_Digital NewAges.png b/project/1647425704_16_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647425704_16_Digital NewAges.png diff --git a/project/1647425925_191_Digital NewAges.png b/project/1647425925_191_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647425925_191_Digital NewAges.png diff --git a/project/1647426023_532_Digital NewAges.png b/project/1647426023_532_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647426023_532_Digital NewAges.png diff --git a/project/1647426048_707_Digital NewAges.png b/project/1647426048_707_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647426048_707_Digital NewAges.png diff --git a/project/1647426359_77_Digital NewAges.png b/project/1647426359_77_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647426359_77_Digital NewAges.png diff --git a/project/1647426416_846_Digital NewAges.png b/project/1647426416_846_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647426416_846_Digital NewAges.png diff --git a/project/1647426498_126_Digital NewAges.png b/project/1647426498_126_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647426498_126_Digital NewAges.png diff --git a/project/1647426578_384_Digital NewAges.png b/project/1647426578_384_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647426578_384_Digital NewAges.png diff --git a/project/1647426656_911_Digital NewAges.png b/project/1647426656_911_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647426656_911_Digital NewAges.png diff --git a/project/1647426750_986_Digital NewAges.png b/project/1647426750_986_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647426750_986_Digital NewAges.png diff --git a/project/1647427419_983_Digital NewAges.png b/project/1647427419_983_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647427419_983_Digital NewAges.png diff --git a/project/1647429400_499_Digital NewAges.png b/project/1647429400_499_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647429400_499_Digital NewAges.png diff --git a/project/1647429648_640_Digital NewAges.png b/project/1647429648_640_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647429648_640_Digital NewAges.png diff --git a/project/1647429800_98_Digital NewAges.png b/project/1647429800_98_Digital NewAges.png Binary files differnew file mode 100644 index 0000000..14eb86a --- /dev/null +++ b/project/1647429800_98_Digital NewAges.png diff --git a/project/1647430269_904_Y2Mate.is - Ein Jäger aus Kurpfalz ♞ [German march][instrumental]-doVpPxjbkTQ-160k-1647427146670.mp3 b/project/1647430269_904_Y2Mate.is - Ein Jäger aus Kurpfalz ♞ [German march][instrumental]-doVpPxjbkTQ-160k-1647427146670.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/project/1647430269_904_Y2Mate.is - Ein Jäger aus Kurpfalz ♞ [German march][instrumental]-doVpPxjbkTQ-160k-1647427146670.mp3 diff --git a/project/1647430349_696_germanfolk.mp3 b/project/1647430349_696_germanfolk.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/project/1647430349_696_germanfolk.mp3 diff --git a/project/1647430389_884_germanfolk.mp3 b/project/1647430389_884_germanfolk.mp3 Binary files differnew file mode 100644 index 0000000..1764f88 --- /dev/null +++ b/project/1647430389_884_germanfolk.mp3 diff --git a/project/1647478207_402_demon_head.blend b/project/1647478207_402_demon_head.blend Binary files differnew file mode 100644 index 0000000..2022c1a --- /dev/null +++ b/project/1647478207_402_demon_head.blend diff --git a/project/1647478320_597_Erika.mp3 b/project/1647478320_597_Erika.mp3 Binary files differnew file mode 100644 index 0000000..e893114 --- /dev/null +++ b/project/1647478320_597_Erika.mp3 diff --git a/project/1647478399_861_Erika.mp3 b/project/1647478399_861_Erika.mp3 Binary files differnew file mode 100644 index 0000000..e893114 --- /dev/null +++ b/project/1647478399_861_Erika.mp3 diff --git a/res/bg.jpg b/res/bg.jpg Binary files differnew file mode 100644 index 0000000..31b11e5 --- /dev/null +++ b/res/bg.jpg diff --git a/res/dachai.png b/res/dachai.png Binary files differnew file mode 100644 index 0000000..d30f86d --- /dev/null +++ b/res/dachai.png diff --git a/res/main.js b/res/main.js new file mode 100644 index 0000000..543cd16 --- /dev/null +++ b/res/main.js @@ -0,0 +1,105 @@ + +// play music + +var currentAudio; +var currentPlay; + +function showPlayButton(cover) { + var play = cover.getElementsByClassName("play_img"); + play[0].style.display="inline"; + play[0].style.cursor="pointer"; +} + +function hidePlayButton(cover) { + var play = cover.getElementsByClassName("play_img"); + play[0].style.display="none"; +} + +function playMusic(play) { + var src = play.getAttribute("audiosrc"); + if(currentPlay != null){ + currentAudio.pause(); + hidePlayButtonSelf(currentPlay); + pauseMusic(currentPlay); + } + currentAudio = new Audio(src); + currentAudio.play(); + + currentPlay = play; + + play.src="./res/pause_cover.png"; + play.onclick = function() { + pauseMusic(play); + }; + play.onmouseleave = null; + + play.parentElement.onmouseleave = null; +} + +function pauseMusic(play) { + if(currentPlay == play){ + currentAudio.pause(); + currentPlay = null; + //hidePlayButtonSelf(play); + } + + play.src="./res/play_cover.png"; + play.onclick = function() { + playMusic(play); + } + play.onmouseleave = function() { + hidePlayButtonSelf(play); + } + + play.parentElement.onmouseleave = function() { + hidePlayButton(play.parentElement); + } +} + +function showPlayButtonSelf(play) { + play.style.display="inline"; + play.style.cursor="pointer"; +} + +function hidePlayButtonSelf(play) { + play.style.display="none"; + play.style.cursor="auto"; +} + +// + +function changeMusicListWidth () { + var music_list = document.getElementById("music_list"); + var music_outer = document.getElementById("music_outer"); + var outer_width = music_outer.offsetWidth; + music_list.style.width = Math.floor( outer_width / 120) * 120; +} + +window.onload = function() { + changeMusicListWidth(); +} + +window.onresize = function(){ + changeMusicListWidth(); +} + +// time + +function formatDate(stamp){ + var time = new Date(stamp * 1000); + var y = time.getFullYear(); //年 + var m = time.getMonth() + 1; //月 + if(m < 10){ m = '0' + m } + var d = time.getDate(); //日 + if(d < 10){ d = '0' + d } + var h = time.getHours(); //时 + if(h < 10){ h = '0' + h } + var mm = time.getMinutes(); //分 + if(mm < 10){ mm = '0' + mm } + var s = time.getSeconds(); //秒 + if(s < 10){ s = '0' + s } + var timeStr = m+"/"+d+", "+y; + //var timeStr = y+"-"+m+"-"+d +" "+h+":"+mm+":"+s; + return timeStr; +} + diff --git a/res/pause_cover.png b/res/pause_cover.png Binary files differnew file mode 100644 index 0000000..ebf3288 --- /dev/null +++ b/res/pause_cover.png diff --git a/res/play_cover.png b/res/play_cover.png Binary files differnew file mode 100644 index 0000000..c7f8ca6 --- /dev/null +++ b/res/play_cover.png diff --git a/res/styles.css b/res/styles.css new file mode 100644 index 0000000..92fdd2d --- /dev/null +++ b/res/styles.css @@ -0,0 +1,198 @@ +body{ + /* + background-image: url(bg.jpg); + background-repeat: repeat; + */ + background-color: #3a3a3a; + margin-top: 0; +} + +#header{ +} + +#dachai_logo{ + width:100px; + float: left; +} + +#site_title{ + font-size:12px; +} + +#container { + margin:0 auto; + max-width: 720px; + background-color: #fff; + min-height: 100%; +} + +#music_inner { + float: left; + position: relative; + left: 50%; + /* background: #FDD;*/ +} + +#music_outer { + overflow: hidden; +/* background: #FFC;*/ +} + +#music_list { + float: left; + position: relative; + left: -50%; + /* background: #080;*/ +} + +.music_container { + width: 100px; + height: 150px; + background-color: #e9e9e9; + margin: 10px; + float:left; + position:relative; +} + +.music_container .cover_img { + width: 100px; + left: 0px; +} + +.music_container .play_img{ + object-fit: cover; + position: absolute; + left: 0px; + width: 100px; + z-index: 10; + display: none; +} + +.music_container .music_title { + display: block; + height: 45px; + font-size:10px; + padding: 3px; + text-align: center; + overflow:hidden; + line-height: 40px; + text-decoration-line: none; + font-weight:bold; + background:#000; + color:#fff; +} + +.music_container .music_title:hover{ + background:#ffffffff; + color:#3a3a3a; +} + +.music_container .music_image_root { + width: 100px; + height: 100px; +} + +.tags_container { + width:80%; + margin-top: 10px; +} + +.tag_link { + font-size: 80%; + color: #fff; + background: #ccc; + text-decoration: none; + padding: 3px 5px; + border: 0px solid; + border-radius: 4px; + margin-right: 7px; + font-family: serif, monospace, cursive; + font-size:15px; +} + +.tag_link:hover{ + background: rgb(0, 0, 0); + color: #fff; +} + +#titlebar { + padding:6px; + border-top:1px solid #000; + border-bottom:1px solid #000; +} + +#titlebar .title_link{ + text-decoration-line: none; + color:#000; + float: left; + display: block; + padding: 2px 5px; + margin-right: 10px; +} + +#titlebar .title_link:hover{ + color:#fff; + background-color: #000; +} + +#titlebar .search{ + float: right; + height: auto; +} + +#seach_form{ + margin: 0; +} + +#searchbar_input { + max-width: 150px; +} + +#music_player_container { + max-width: 95%; + margin: 0 auto; +} + +#music_player_container .music_cover{ + width: 300px; + margin: 0 auto; + margin-bottom: 10px; + display: block; +} + +#music_player { + width: 100%; + margin-bottom: 10px; +} + +#music_player_container label { + font-size: 12px; +} + +#music_player_container a { + font-size: 12px; +} + +#music_player_container .key { + margin-right: 5px; + line-height: 20px; +} + +#music_player_container .value { + font-weight: bold; +} + +#search-condition { + width: 100%; + padding: 10px; +} + +#search-condition .search-hint { + +} + +#search-condition .search-value { + font-weight:bold; +} + + diff --git a/search.php b/search.php new file mode 100644 index 0000000..4a838e4 --- /dev/null +++ b/search.php @@ -0,0 +1,43 @@ +<html> + +<head> +<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, target-densityDpi=device-dpi"> +<link rel="stylesheet" href="./res/styles.css"> +<script src="./res/main.js"></script> +</head> + +<body> +<div id="container"> + <?php include_once('music.php');?> + <?php include_once('header.php');?> + <?php include_once('titlebar.php');?> + <?php include_once 'config.php'?> + <?php + $type = $_GET['type']; // 'tag', 'name' + $value = $_GET['value']; // tag id, name + $page = $_GET['page']; // page从0开始 + ?> + <div id="search-condition"> + <?php + $musiclist = null; + if($type == "tag") { + echo '<label class="search-hint">Tag : </label>'; + $tag = fetch_tag_by_id($value); + echo '<label class="search-value">' . $tag->name . "</label>"; + $musiclist = fetch_musics_by_tag($tag->uid, $page * Config::$music_per_page, Config::$music_per_page); + } + else if($type == "name") { + echo '<label class="search-hint">Searching : </label>'; + echo '<label class="search-value">' . $value . "</label>"; + + $musiclist = fetch_musics_by_name($value, $page * Config::$music_per_page, Config::$music_per_page); + } + + ?> + </div> + <?php include_once('musiclist.php');?> + +</div> +</body> + +</html>
\ No newline at end of file diff --git a/search_form.php b/search_form.php new file mode 100644 index 0000000..e3f4111 --- /dev/null +++ b/search_form.php @@ -0,0 +1,5 @@ +<?php + $name = $_POST['content']; + + header('Location: '.'search.php?page=0&type=name&value=' . $name); +?>
\ No newline at end of file diff --git a/tags.php b/tags.php new file mode 100644 index 0000000..d1c4282 --- /dev/null +++ b/tags.php @@ -0,0 +1,26 @@ +<html> + +<head> +<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, target-densityDpi=device-dpi"> +<link rel="stylesheet" href="./res/styles.css"> +<script src="./res/main.js"></script> +</head> + +<body> + <div id="container"> + <div style="padding: 10px;"> + <label>Tags:</label> <br/> + <div class="tags_container"> + <?php + require_once 'music.php'; + require_once 'template.php'; + $tags = fetch_all_tags() ; + foreach($tags as $tag){ + html_tag($tag); + } + ?> + </div> + </div> + </div> +</body> +</html>
\ No newline at end of file diff --git a/template.php b/template.php new file mode 100644 index 0000000..04965b6 --- /dev/null +++ b/template.php @@ -0,0 +1,58 @@ +<?php require_once 'music.php'?> +<?php require_once 'functions.php'?> + +<?php + +function html_music($music) { + echo '<div class="music_container">'; + echo ' <div class="music_image_root" onmouseenter="showPlayButton(this)" onmouseleave="hidePlayButton(this)">'; + echo ' <img class="cover_img" src="'. $music->cover .'"/>'; + echo ' <img class="play_img" audiosrc="' . $music->path . '" src="./res/play_cover.png" onclick="playMusic(this)" onmouseenter="showPlayButtonSelf(this)" onmouseleave="hidePlayButtonSelf(this)"/>'; + echo ' </div>'; + echo ' <a href="booth.php?id=' . $music->uid . '" class="music_title">' . $music->title . '</a>'; + echo '</div>' ; +} + +function html_tag($tag) { + echo '<a href="search.php?page=0&type=tag&value=' . $tag->uid. '" class="tag_link">' . $tag->name . '</a>'; +} + +function get_html_tag($tag) { + return '<a href="search.php?page=0&type=tag&value=' . $tag->uid. '" class="tag_link">' . $tag->name . '</a>'; +} + +function html_music_player($music) { + if($music == null) + return ; + $tags = fetch_music_tags($music->uid) ; + $html_tags = ""; + foreach($tags as $tag){ + $html_tags = $html_tags . get_html_tag($tag); + } + + echo '<img class="music_cover" src=" ' . $music->cover . ' " />' ; + echo '<audio id="music_player" src="' . $music->path . '" controls="controls">'; + echo ' Sorry, your browser do not support audio.'; + echo '</audio>' ; + + echo '<label class="key">Name:</label>'; + echo '<label class="value">' . $music->title . '</label><br/>'; + + echo '<label class="key">Date:</label>'; + echo '<label id="music_time" class="value" timestamp="' . $music->time . '" ></label><br/>'; + + echo '<label class="key">Tags:</label>'; + echo $html_tags; + echo '<br/>'; + + echo '<label class="key">Music File:</label>'; + echo '<label class="value"><a href="' . $music->path . '">Download</a></label><br/>'; + + if($music->project != ""){ + echo '<label class="key">Project File:</label>'; + echo '<label class="value"><a href=" ' . $music->project . '">Download</a></label>'; + } + +} + +?>
\ No newline at end of file diff --git a/titlebar.php b/titlebar.php new file mode 100644 index 0000000..0d94309 --- /dev/null +++ b/titlebar.php @@ -0,0 +1,18 @@ +<div id="titlebar"> + + <a href="./index.php" class="title_link">Music</a> + + <a href="./albums.php" class="title_link">Albums</a> + + <a href="./tags.php" class="title_link">Tags</a> + + <div class="search"> + <form id="seach_form" action="search_form.php" method="post" > + <input type="text" id="searchbar_input" name="content" placeholder="Search..."> + <input type="submit" id="searchbar_submit" value="Search"> + </form> + </div> + + <div style="clear:both;"></div> + +</div>
\ No newline at end of file diff --git a/upload.php b/upload.php new file mode 100644 index 0000000..ae9abbc --- /dev/null +++ b/upload.php @@ -0,0 +1,62 @@ + +<?php + +// 上传文件处理 + +function is_upload_notempty($file) +{ + return $file["tmp_name"] != NULL; +} + +function upload_file($target_dir, $file) +{ + $filename = time() . '_' . rand(0, 1000) . '_' . basename($file['name']); + + $target_file = $target_dir . '/' . $filename; + + $uploadOk = 1; + $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); + + // Check if image file is a actual image or fake image + // if(isset($_POST["submit"])) { + // $check = getimagesize($file["tmp_name"]); + // if($check !== false) { + // echoln( "File is an image - " . $check["mime"] . "."); + // $uploadOk = 1; + // } else { + // echoln( "File is not an image."); + // $uploadOk = 0; + // } + // } + + // Check if file already exists + if (file_exists($target_file)) { + echoln( "Sorry, file already exists."); + $uploadOk = 0; + } + + // Check file size + // if ($file["size"] > 500000) { + // echoln( "Sorry, your file is too large."); + // $uploadOk = 0; + // } + + // Check if $uploadOk is set to 0 by an error + if ($uploadOk == 0) { + echoln( "Sorry, your file was not uploaded."); + // if everything is ok, try to upload file + } else { + if (move_uploaded_file($file["tmp_name"], $target_file)) { + //echoln( "The file ". htmlspecialchars( basename( $file["name"])). " has been uploaded."); + $uploadOk = 1; + } else { + $uploadOk = 0; + echoln( "Sorry, there was an error uploading your file."); + } + } + + return array($uploadOk, $target_file); + +} + +?> |