📄 index.php
字号:
<?
include("sources/session.php");
// Index.php is the main page of audio file.
// Musicbox version 2.1
// TeaM SCRiPTMAFiA 2005
// Music Displayer
class Music {
/*** Continue configuring here ***/
// Location of the top of your template of your website (path)
var $page_header = "template/header.php";
// Location of the bottom of your website (path)
var $page_footer = "template/footer.php";
// Location of the top of your template for pop-ups (path)
var $popup_header = "template/popup_header.html";
// Location of the footer popup
var $popup_footer = "template/popup_footer.html";
// Title of your Page
var $page_title = "Musicbox Version 2.1";
// MySQL Information
// Please dont forget to enter mysql information here
var $mysqlHostname = "localhost";
var $mysqlUsername = "insert your database details here";
var $mysqlPassword = "insert your database details here";
var $mysqlDbName = "insert your database details here";
// Path of folder to place your M3U,RPM,RAM playlists (no slashes /)
var $m3u_folder = "temp";
// Path to where you are storing mp3,ram or rpm (without trailing slash /)
var $musicpath = "/home/username/public_html/musicboxv2/audio";
// Path to the root of your musicbox directory (without trailing slash /)
var $siteroot= "/home/username/public_html/musicboxv2";
// Website URL to the musicbox directory (without trailing slash /)
var $url = "http://www.yoursitename.com/musicboxv2";
// Name of this file
// If you renamed index.php to somepage.php then also rename in template/js/juke.js
var $thisfile = "index.php";
// Please edit this line
// Your email for mail a song
var $email = "listen@yoursitename.com";
/**** No need to edit anything below this line ****/
var $mailextra;
var $extensions;
var $username;
var $mysqlConn;
function Music($action, $username)
{
$this->username = $username;
$this->mailextra = "From: ".$this->email."\r\n";
// Connect to the database
$this->dbConnect();
//include($page_header);
?>
<html>
<head>
<SCRIPT LANGUAGE='JavaScript' SRC='template/js/fill.js'></SCRIPT>
<SCRIPT LANGUAGE='JavaScript' SRC='template/js/juke.js'></SCRIPT>
<SCRIPT LANGUAGE='JavaScript' SRC='template/js/status.js'></SCRIPT>
</head>
<?
if( $action == 'song' || $action == 'lyrics' || $action == 'playlist' || $action == 'rate' || $action == 'mailfriend' ) {
@include($this->popup_header);
} else {
@include($this->page_header);
}
// Determine Action
switch( $action ) {
case 'genre':
$this->genre();
break;
case 'lyrics':
$this->lyrics();
break;
case 'mailfriend':
$this->mailfriend();
break;
case 'top':
$this->topx();
break;
case 'rate':
$this->rateSong();
break;
case 'album':
$this->Album();
break;
case 'song':
$this->song();
break;
case 'playlist':
$this->playlist();
break;
case 'removefromplaylist':
$this->removefromplaylist();
break;
case 'viewplaylist':
$this->viewPlaylist();
break;
case 'viewallplaylists':
$this->viewAllPlaylists();
break;
case 'showallplaylists':
$this->showAllPlaylists();
break;
case 'showUsersplaylists':
$this->showUsersPlaylists();
break;
case 'artist':
$this->artist();
break;
case 'search':
$this->search();
break;
case 'viewmailfriend':
$this->viewmailfriend();
break;
case 'addlyrics':
$this->addlyrics();
break;
default:
$this->Album();
}
if( $action == 'song' || $action == 'lyrics' || $action == 'playlist' || $action == 'rate' || $action == 'mailfriend' ) {
@include($this->popup_footer);
} else {
@include($this->page_footer);
}
}
/********** Database Functions **********/
function dbConnect()
{
$this->mysqlConn = mysql_connect( $this->mysqlHostname, $this->mysqlUsername, $this->mysqlPassword )
or die("Error: Unable to connect to MySQL server.");
mysql_select_db( $this->mysqlDbName, $this->mysqlConn ) or die("Error: Unable to connect to MySQL database.");
}
/********** GUI Functions **********/
function sortby($action)
{
// Sort By
print("<div id='sort' align='right'>\n");
print("<form name='sort' action='".$this->thisfile."?".$action."' method='post'>\n");
print("Sort by: <select name='sort' onChange='javascript:document.sort.submit();'>\n");
print("<option value='album' SELECTED>-----------</option>\n");
print("<option value='album'>Album Name</option>\n");
print("<option value='artist'>Artist Name</option>\n");
print("</select>\n");
print("</form></div>\n");
}
function topButtons()
{
print("<p><div align=center><input name='submit1' type='button' value='Play Selected' onClick='javascript:playAll()' class='useme'> <input name='Button' type='button' onClick='selectNone()' value='Select None' class='useme'> <input name='Button' type='button' onClick='selectAll()' value='Select All' class='useme'></p></div>\n");
}
function bottomButtons()
{
global $session;
print("<p><div align=center><input name='submit1' type='button' value='Play Selected' onClick='javascript:playAll()' class='useme'> ".(($session->logged_in)?" <input name='addto' type='button' value='Add Selected to Playlist' onClick='javascript:addAllToPlaylist()' class='useme'> ":"")."</p>
</div>\n");
print("<script>
function bnHover(){
event.srcElement.className = 'useyou';
}
function bnNormal(){
event.srcElement.className = 'useme';
}
if(document.all){
buttons = document.getElementsByTagName('input');
for(i=0;i<buttons.length;i++){
if(buttons[i].className == 'useme'){
buttons[i].onmouseover = bnHover;
buttons[i].onmouseout = bnNormal;
}
}
}
</script>");
}
function mysqlTable($resource,$headers,$base_url,$include_id)
{
$rowid = 0;
$idcol = 0;
// Resource is empty!
if( !(mysql_num_rows($resource) > 0) )
{
print("<p>No records found</p>");
exit;
}
// Get First Row for Fields
$row = mysql_fetch_assoc($resource);
// Print Fields
print("<table cellspacing='1' cellpadding='4'>\n");
print(" <tr>\n");
$count = 0;
while ($field = current($row)) {
$count++;
if( key($row) == 'id' ) {
$idcol = $count;
}
if( !(key($row) == 'id' && !$include_id) ) {
print(" <th>".preg_replace("/_/"," ",key($row))."</th>\n");
}
next($row);
}
// Print Extra Headers
while( $header = current($headers) ) {
print(" <th>".key($headers)."</th>\n");
next($headers);
}
print(" </tr>\n");
$id=0;
do {
print(" <tr id='row".$rowid."' onMouseOver=\"this.bgColor='#00CC66'\" onMouseOut=\"this.bgColor=''\">\n");
$count = 0;
foreach( $row as $field ) {
$count++;
if( $count == $idcol ) { $id = $field; }
if( !( $count == $idcol && !$include_id) ) {
if( preg_match("/http:\/\//",$field ) ) {
$field = "<a href='".$field."'>".$field."</a>";
}
print(" <td>".$field."</td>\n");
}
}
foreach( $headers as $field ) {
print(" <td style='text-align: center'>[ <a href='".preg_replace("/\[id\]/",$id,$base_url).$field."'>X</a> ]</td>\n");
}
print(" </tr>\n");
$rowid++;
} while( $row = mysql_fetch_assoc($resource) );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -