⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 audioadmin.php

📁 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序
💻 PHP
📖 第 1 页 / 共 3 页
字号:
	
	function delalbum($id)
	{
		global $_GET;
		if( $_GET['page'] ) {
			$query = "DELETE FROM album WHERE id = '".$id."'";
			mysql_query($query);
		print("<p>album deleted succesfully.</p>");								
		} else {
			$query = "SELECT * FROM album WHERE id = '".$id."'";
			$row = mysql_fetch_assoc( mysql_query($query) );
			
			$album = $row['album_name'];
		
			// Form
			print("<form action='?action=album&page=del&save=yes&id=".$id."' method='post' name='form' id='form'>\n");
			print("<p>Are you sure that you would like to delete the album \"".$album."\"?");
			print("<input type='hidden' name='album' value='".$album."'></p>\n");
			print("<p><input name='Submit' type='submit' class='year' id='Submit' value='Confirm Delete'>\n");
			print("</p></form>\n");
		}
	}
	
	
	/********** Artist Functions **********/
	
	function artist()
	{
		global $_GET;
		$page = $_GET['page'];
		
		switch($_GET[page]) {
		case 'del':
			$this->delArtist($_GET['id']);
			break;
		case 'edit':
			$this->infoArtist('edit');
			break;
		default:	// default new
			$this->infoArtist('new');
			break;		
		}
		
		$query = "SELECT id, name as Artist_Name, url as Website FROM artist ORDER BY name ASC";
		if( $result = mysql_query($query) ) { $this->mysqlTable($result,array('Delete'=>'page=del','Edit'=>'page=edit'),"?action=artist&id=[id]&",false); }
		
	}
	
	function infoArtist($type)
	{
	
	global $_GET;
		$id = addslashes($_GET['id']);
	
		print("<div id='info'>\n");
		
		// Save Information?
		if( $_GET['save'] == 'yes' ) {
			$artist_name = addslashes($_POST['artist_name']);
			$url = addslashes($_POST['url']);
			$photo_url = addslashes($_POST['artist_photo']);
			$artist_info = $_POST['artist_info'];
		
			if( $type == 'new' ) {
				$query = "INSERT INTO artist ( name , url , artist_photo , artist_info ) ";
				$query .= "VALUES ('".$artist_name."', '".$url."', '".$photo_url."', '".$artist_info."')";
			} else {
				$query = "UPDATE artist SET name = '".$artist_name."', url = '".$url."', artist_photo = '".$photo_url."', artist_info = '".$artist_info."' WHERE id = '".$id."'";			
			}
			
			// Run Query
			if( mysql_query($query) ) {
				print("<p>Success! We were able to ".(($type=='new')?"create a new":"edit the specified")." artist.</p>");
			} else {
				print("<p>Warning: We were unable to ".(($type=='new')?"create a new":"edit the specified")." artist.</p>");
			}
			
		}
		
		// Determine Type of Form
		if( $type == 'new' ) {
			print("<h1>New Artist</h1>\n");
			$artist_name = "";
			$url = "http://";
			$photo_url = "http://";
			$artist_info = "";
		} else {
					
			print("<h1>Edit Artist</h1>\n");
			
			$query = "SELECT * FROM artist WHERE id = '".$id."'";
			$row = mysql_fetch_assoc( mysql_query($query) );
			
			$artist_name = $row['name'];
			$url = $row['url'];
			$photo_url = $row['artist_photo'];
			$artist_info = $row['artist_info'];			
		}
		
		// Form
		print("<form action='?action=artist&page=".$type."&save=yes&id=".$id."' method='post' name='form' id='form'>\n");
		print("  <table class='tdrow2' width='500' border='0' cellpadding='0' cellspacing='0'>\n");
		print("     <tr>\n");
		print("       <td width='150'><label for='artist_name'>Artist Name:</label></td>\n");
		print("       <td><input name='artist_name' id='artist_name' type='text' maxlength='255' value='".$artist_name."'></td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'><label for='url'>Website:</label></td>\n");
		print("       <td><input name='url' id='url' type='text' maxlength='255' value='".$url."'></td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'><label for='artist_photo'>Photo URL:</label></td>\n");
		print("       <td><input name='artist_photo' id='artist_photo' type='text' maxlength='255' value='".$photo_url."'></td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'><label for='artist_info'>Artist Bio:</label></td>\n");
		print("       <td rowspan='2'><textarea name='artist_info' id='artist_info'>".$artist_info."</textarea></td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'>&nbsp;</td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'>&nbsp;</td>\n");
		print("       <td><input name='Submit' type='submit' class='year' id='Submit' value='Submit'>\n");
		print("        <input name='Reset' type='reset' class='year' id='Reset' value='Reset'>\n");
		print("       </td>\n");
		print("     </tr>\n");
		print("  </table>\n");
		print("</form>\n");

		print("</div>\n");
	}
	
	
	function delArtist($id)
	{
		$query = "DELETE from artist where id='".$id."'";
		$result = mysql_query($query);
	}
	
	/********** Format Functions **********/
	
	function format()
	{
		$page = $_GET['page'];
		
		switch( $page ) {
		case 'del':
			$this->delFormat(addslashes($_GET['id']));
			break;
		case 'edit':
			$this->infoFormat('edit');
			break;
		default:	// default new
			$this->infoFormat('new');
			break;		
		}
		
		$query = "SELECT id, format as Format_Type, extension as Extension, format_url as Website FROM format WHERE 1";
		if( $result = mysql_query($query) ) { $this->mysqlTable($result,array('Delete'=>'page=del','Edit'=>'page=edit'),"?action=format&id=[id]&",false); }
				
	}
	
	
	function infoFormat($type)
	{
		global $_GET;
		$id = addslashes($_GET['id']);
	
		print("<div id='info'>\n");
		
		// Save Information?
		if( $_GET['save'] == 'yes' ) {
			$format = addslashes($_POST['format_name']);
			$extension = addslashes($_POST['format_ext']);
			$url = addslashes($_POST['format_url']);
		
			if( $type == 'new' ) {
				$query = "INSERT INTO format ( format , extension, format_url ) VALUES ('".$format."', '".$extension."', '".$url."')";
			} else {
				$query = "UPDATE format SET format = '".$format."', extension = '".$extension."', format_url = '".$url."' WHERE id = '".$id."'";			
			}
			
			// Run Query
			if( mysql_query($query) ) {
				print("<p>Success! We were able to ".(($type=='new')?"create a new":"edit the specified")." format.</p>");
			} else {
				print("<p>Warning: We were unable to ".(($type=='new')?"create a new":"edit the specified")." format.</p>");
			}

			
		}
		
		// Determine Type of Form
		if( $type == 'new' ) {
			print("<h1>New Format</h1>\n");
			$format = "";
			$format_url = "http://";
			$format_ext = "";
		} else {
					
			print("<h1>Edit Format</h1>\n");
			
			$query = "SELECT * FROM format WHERE id = '".$id."'";
			$row = mysql_fetch_assoc( mysql_query($query) );
			
			$format = $row['format'];
			$format_url = $row['format_url'];
			$format_ext = $row['extension'];
			
		}
		
		// Form
		print("<form action='?action=format&page=".$type."&save=yes&id=".$id."' method='post' name='form' id='form'>\n");
		print("  <table class='tdrow2' width='500' border='0' cellpadding='0' cellspacing='0'>\n");
		print("     <tr>\n");
		print("       <td width='150'><label for='format_name'>Format Name:</label></td>\n");
		print("       <td><input name='format_name' id='format_name' type='text' maxlength='255' value='".$format."'></td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'><label for='format_url'>Format Extension:</label></td>\n");
		print("       <td><input name='format_ext' id='format_ext' type='text' maxlength='255' value='".$format_ext."'></td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'><label for='format_url'>Format URL:</label></td>\n");
		print("       <td><input name='format_url' id='format_url' type='text' maxlength='255' value='".$format_url."'></td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'>&nbsp;</td>\n");
		print("       <td><input name='Submit' type='submit' class='year' id='Submit' value='Submit'>\n");
		print("        <input name='Reset' type='reset' class='year' id='Reset' value='Reset'>\n");
		print("       </td>\n");
		print("     </tr>\n");
		print("  </table>\n");
		print("</form>\n");
		
		print("</div>\n");
	}
	
	
	function delFormat($id)
	{
		if( $_GET['save'] ) {
			$query = "DELETE FROM format WHERE id = '".$id."'";
			mysql_query($query);
			print("<p>Format \"".$_POST['format']."\" deleted succesfully.</p>");								
		} else {
			$query = "SELECT * FROM format WHERE id = '".$id."'";
			$row = mysql_fetch_assoc( mysql_query($query) );
			
			$format = $row['format'];
		
			// Form
			print("<form action='?action=format&page=del&save=yes&id=".$id."' method='post' name='form' id='form'>\n");
			print("<p>Are you sure that you would like to delete the format \"".$format."\"?");
			print("<input type='hidden' name='format' value='".$format."'></p>\n");
			print("<p><input name='Submit' type='submit' class='year' id='Submit' value='Confirm Delete'>\n");
			print("</p></form>\n");
		}
	}
	
	
	/********** PLaylist Functions ***********/
	function playlist()
	{
			
		$query = "SELECT playlist.id as id, playlist.playlist_name, playlist.user_id FROM playlist, playlistsong WHERE playlist.id = playlistsong.playlist_id GROUP BY playlistsong.playlist_id ORDER BY playlist.playlist_name ASC";
		if( $result = mysql_query($query) ) { $this->mysqlTable($result,array('View'=>'&'),"index.php?action=viewplaylist&id=[id]",false); }
		if( mysql_num_rows($result) == 0 ) { print("No playlists found"); }
	
	}
	
	/********** Mail a Friend Functions ***********/
	function mailfriend()
	{
			
		$start = $_GET['start'];
		if( $start == '' ) { $start = 0; }
		$query = "SELECT user_id, sent_to, subject, message FROM mailfriend ORDER BY id DESC LIMIT ".$start.",30";
		$result = mysql_query($query);
		
		$i=0;
		for( $i=0 ; $row = mysql_fetch_assoc($result) ; $i++)
		{
			print("<p>User ID: ".$row['user_id']."<br>\n");
			print("Sent to: ".$row['sent_to']."<br>\n");
			print("Subject: ".$row['subject']."<br>\n");
			print($row['message']."</p>\n");
			print("<hr>");
		}
		print("<p>\n");
		if( $start != 0 ) {
			print("<a href='admin.php?action=mailfriend&start=".($start-30)."'>Previous Page</a>  || ");
		}
		if( $i > 25 ) {
			print("<a href='admin.php?action=mailfriend&start=".($start+30)."'>Next Page</a>");
		}
		print("</p>\n");
	
	}
	
	
	/********** Genre Functions **********/
	
	function genre()
	{
		
		$page = $_GET['page'];
		
		switch( $page ) {
		case 'del':
			$this->delGenre(addslashes($_GET['id']));
			break;
		case 'edit':
			$this->infoGenre('edit');
			break;
		default:	// default new
			$this->infoGenre('new');
			break;		
		}
		
		$query = "SELECT id, genre as Genre_Name FROM genre WHERE 1";
		if( $result = mysql_query($query) ) { $this->mysqlTable($result,array('Delete'=>'page=del','Edit'=>'page=edit'),"?action=genre&id=[id]&",false); }
		
	
	}
	
	function infoGenre($type)
	{
	global $_GET;
		$id = addslashes($_GET['id']);
	
		print("<div id='info'>\n");
		
		// Save Information?
		if( $_GET['save'] == 'yes' ) {
			$genre = addslashes($_POST['genre']);
		
			if( $type == 'new' ) {
				$query = "INSERT INTO genre ( genre ) VALUES ('".$genre."')";
			} else {
				$query = "UPDATE genre SET genre = '".$genre."' WHERE id = '".$id."'";			
			}
			
			// Run Query
			if( mysql_query($query) ) {
				print("<p>Success! We were able to ".(($type=='new')?"create a new":"edit the specified")." Genre.</p>");
			} else {
				print("<p>Warning: We were unable to ".(($type=='new')?"create a new":"edit the specified")." Genre.</p>");
			}
			
		}
		
		// Determine Type of Form
		if( $type == 'new' ) {
			print("<h1>New Genre</h1>\n");
			$genre = "";
		} else {
		
			print("<h1>Edit Genre</h1>\n");
			$query = "SELECT * FROM genre WHERE id = '".$id."'";
			$row = mysql_fetch_assoc( mysql_query($query) );
			
			$genre = $row['genre'];
			
		}
		
		// Form
		print("<form action='?action=genre&page=".$type."&save=yes&id=".$id."' method='post' name='form' id='form'>\n");
		print("  <table class='tdrow2' width='500' border='0' cellpadding='0' cellspacing='0'>\n");
		print("     <tr>\n");
		print("       <td width='150'><label for='genre'>Genre Name:</label></td>\n");
		print("       <td><input name='genre' id='genre' type='text' maxlength='255' value='".$genre."'></td>\n");
		print("     </tr>\n");
		print("     <tr>\n");
		print("       <td width='150'>&nbsp;</td>\n");
		print("       <td><input name='Submit' type='submit' class='year' id='Submit' value='Submit'>\n");
		print("        <input name='Reset' type='reset' class='year' id='Reset' value='Reset'>\n");
		print("       </td>\n");
		print("     </tr>\n");
		print("  </table>\n");
		print("</form>\n");
		
		print("</div>\n");
	}
	
	
	function delGenre($id)
	{
		if( $_GET['save'] ) {
			$query = "DELETE FROM genre WHERE id = '".$id."'";
			mysql_query($query);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -