Esempio n. 1
0
function delete_music($id)
{
    $update = "UPDATE music SET deleted ='y' where id=" . $id;
    $result = mysql_query($update);
    if (!$result) {
        echo "'Error deleting the music entry from the database: " . $update . "<br>";
    } else {
        $music = get_music($id);
        echo "<div class=\"center\"><h1>Success!</h1>" . "<h3>The new music entry <span class=\"success\">" . $music['artist'] . " - " . $music['song'] . "</span> has been deleted.</h3></div>";
    }
}
Esempio n. 2
0
                    echo '<li>' . $value['name'] . ' - ' . $value['singer'] . '&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=edit&id=' . $value['id'] . '">编辑</a>&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=del&id=' . $value['id'] . '">删除</a></li>';
                }
                echo '</ol><a href="' . $_SERVER['PHP_SELF'] . '">返回首页</a>';
            } else {
                echo '<p>无搜索结果</p>';
            }
        }
    } elseif ($_GET['action'] == 'add') {
        if ($_POST) {
            $post_data = get_post_data();
            $insert_query = mysql_query('insert into `music_list`(`name`,`url`,`singer`,`lrc`,`lrc_data`) values(\'' . $post_data['name'] . '\',\'' . $post_data['url'] . '\',\'' . $post_data['singer'] . '\',\'' . $post_data['lrc'] . '\',\'' . $post_data['lrc_data'] . '\')');
            if ($insert_query) {
                msg('数据插入成功');
            } else {
                msg('数据插入失败<br />' . mysql_errno() . ' ' . mysql_error());
            }
        } else {
            echo '<form action="" method="post"><p><label>歌&nbsp;&nbsp;&nbsp;&nbsp;名:<input type="text" name="name" /></p><p><label>歌&nbsp;&nbsp;&nbsp;&nbsp;手:<input type="text" name="singer" /></p><p><label>下载地址:<input type="text" name="url" value="http://" /></p><p><a href="http://tool.liujiantao.me/upload/" target="_blank">歌曲上传</a></p><p>显示 lrc 歌词: <label><input type="radio" name="lrc" value="1" />是</label>&nbsp;&nbsp;<label><input type="radio" name="lrc" value="0" checked="checked" />否</label></p><p>lrc 歌词(可选):<br /><textarea name="lrc_data">' . htmlspecialchars($select_query['lrc_data']) . '</textarea></p><p><input type="submit" name="submit" value="确定" /><a href="' . $_SERVER['PHP_SELF'] . '">取消</a></p></form>';
        }
    } else {
        echo '<form action="?action=search" method="post"><p><input name="search" type="text" /></p><p><input type="submit" value="搜索" /></p></form>';
        $all_list = get_music();
        echo '<ol>';
        foreach ($all_list as $value) {
            echo '<li>' . $value['name'] . ' - ' . $value['singer'] . '&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=edit&id=' . $value['id'] . '">编辑</a>&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=del&id=' . $value['id'] . '">删除</a></li>';
        }
        echo '</ol>';
        echo '<a href="' . $_SERVER['PHP_SELF'] . '?action=add">添加新曲目</a>';
    }
    echo_footer();
}
Esempio n. 3
0
        $music = get_music($id);
        echo "<form action=\"music_update.php?id=" . $id . "\" method=\"post\" class=\"form-internal inline input-seperation\" id=\"admin\">";
        require "partials/_music_form.php";
        echo "</form>\n        <div class=\"footnote\">** if any links are over 128 characters: use <a href=\"http://www.bit.ly\" target=_new>bit.ly</a> to shorten the url</div>";
    } else {
        $date = $_POST['date'];
        $artist = $_POST['artist'];
        $song = $_POST['song'];
        $url = $_POST['url'];
        if (!$date || !$artist || !$song) {
            echo '<div class="top-spacer_20 center error">Error - missing required value(s)</div>';
        } else {
            $result = update_music($id, $date, $artist, $song, $url);
            if ($result) {
                echo '<div class="top-spacer_20 center"><h1>Update was successful!</h1>';
                display_music(get_music($id));
                echo "</div>";
            }
        }
    }
    ?>
    <div class="top-spacer_20">
      <a href="music_view_all.php">View all New Music</a>
      <p>
      <a href="cp.php">Control Panel</a>
    </div>
  </div>
</div> <!-- end of row div -->
<?php 
}
require "partials/_footer.php";