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

📄 mail.php

📁 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序 个人主页音乐程序
💻 PHP
📖 第 1 页 / 共 5 页
字号:
		
		if( $_GET['send'] == 'yes' ) {		
		
			$send_to = addslashes($_POST['send_to']);
			$message = addslashes($_POST['message']);
			$href = addslashes($_POST['href']);
			$info = addslashes($_POST['info']);	
			$email = addslashes($_POST['email']);
			$name = addslashes($_POST['name']);
			global $_SESSION;
			if( !$session->logged_in ) {
				$subject = addslashes("<a href='mailto:$email'>$name</a>");
			} else {
				$subject = "";
			}
		
			$query = "SELECT SUM(song.plays) as total_plays, AVG(song.rating/song.num_rating) as average_rating, album.album_photo, song.song_name, album.album_name, artist.name as artist_name, album.id as album_id, artist.id as artist_id FROM song, album, artist WHERE song.album_id = album.id AND song.artist_id = artist.id AND song.id = '".$song_id."' GROUP BY song.id";
			$result = mysql_query($query) or die(mysql_error());
			$row = mysql_fetch_assoc($result);
		    global $_SESSION;
if($this->logged_in)
			$songtable = "<table><tr><td><a href='".$href."'>".$row['song_name']."</a> <img src='".$this->url."/images/".((round($row['average_rating'])<1)?'1':round($row['average_rating']))."_s.gif' alt='".round($row['average_rating'],2)."' border='0'></td><td rowspan='4'><img src='".$row['album_photo']."'></td></tr>\n";
			$songtable .= "<tr><td><span style='font-weight:bold;'>Artist Name:</span> <a href='".$this->url."/".$this->thisfile."?action=artist&id=".$row['artist_id']."'>".$row['artist_name']."</a></td></tr>\n";
			$songtable .= "<tr><td><span style='font-weight:bold;'>Album Name:</span> <a href='".$this->url."/".$this->thisfile."?action=album&id=".$row['album_id']."'>".$row['album_name']."</a></td></tr>\n";
			$songtable .= "<tr><td><span style='font-weight:bold;'>Times Played</span> ".$row['total_plays']."</td></tr></table>\n";		

			$user = array();
			global $_SESSION;
if($this->logged_in)
{

				//$user = $this->get_info();
			} else {
				$user['email'] = $email;
				$user['name'] = $name;
			}

			$query = "INSERT INTO mailfriend (username,sent_to,subject,message, song_id, album_id, artist_id, genre_id) VALUES ('".$this->username."','".$send_to."','".$subject."','".$message."','".$song_id."','".$album_id."','".$artist_id."','".$genre_id."');";
			mysql_query($query) or die(mysql_error());
			mail($send_to,"Listen to it Now","<center> 
 <html><body><link rel='stylesheet' href='template/css/theme.css' type='text/css'> </head><p><CENTER> 
<table width='478'>
<tr>
       <td bgcolor='#FDF1FB' background='template/images/top.jpg' align=right></td>
</tr>
<tr>
       <td bgcolor='#FDF1FB'  background='template/images/top.jpg' align=left><img src='template/images/logo.jpg' width='290' height='60' alt='' border='0'></td>
</tr>
<tr>
       <td bgcolor='#FDF1FB'  background='template/images/top.jpg' align=left></td>
</tr>
</table>

 <table width='478' background='template/images/searchbg.gif'>
<tr>
    <td align=left><form action='index.php?action=search' method='get'>  
<strong>Search:</strong> <input type=radio name='in' value='artist'>&nbsp;Artist</option><input type=radio name='in' value='album' >&nbsp;Album</option> <input type=radio name='in' value='song' checked>&nbsp;Song</option> <input type='textbox' name='term' class='input2'>&nbsp;<input type='hidden' name='action' value='search'>
<input type='hidden' name='start' value='0'><input type='button' value='Search' class='useme'> 
</select></td>
</tr>  </form>
</table>   
<table width='478' border='0' cellspacing='0' cellpadding='2' bgcolor='#FDF1FB'>        <tr>           <td colspan='3'><font face='Verdana, Arial, Helvetica, sans-serif' size='2'>Hae Hi  <a href='mailto:".$user['email']."'>".$user['name']."</a>, <br> The audio clip below was emailed to you from <font face='Verdana, Arial, Helvetica, sans-serif' size='2'><a href='mailto:".$user['email']."'>".$user['name']."</a></font> on our site . Please be sure to visit our Huge audio archives. We hope you like it.</font></td>        </tr>        <tr>           <td colspan='3'>&nbsp;</td>        </tr>        <tr>         <tr>                             <td width='274'><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><p>".$songtable."</p></font></td>                 </tr>        <tr>         <tr>           <td colspan='3'>&nbsp;</td>        </tr>        <tr>           <td colspan=3><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><b>Sender's message:</b></font></td>        </tr>        <tr>           <td colspan='3'><br><font face='Verdana, Arial, Helvetica, sans-serif' size='2'>===================================================</font></td>        </tr>        <tr>           <td colspan='3'><font face='Verdana, Arial, Helvetica, sans-serif' size='2'><p>".$_POST['message']."</p></font></td>        </tr>        <tr>           <td colspan='3'><font face='Verdana, Arial, Helvetica, sans-serif' size='2'>===================================================</font></td>        </tr>        <tr>           <td colspan='3' align='center'><br><font face='Verdana, Arial' size='6'><a target=_blank href='".$href."'><b>Click Here to Listen to it Now</b></a></td>        </tr>        <tr>           <td colspan='3'>&nbsp;</td>        </tr>        <tr>       </table>    </td>  </tr>  <tr>    <td>&nbsp;</td>  </tr></table><br><font face='Verdana, Arial' size='1'>Note: Sender's e-mail as entered on website.</font></CENTER></body></html></center>","MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: ".$this->email."\r\n");
			
			print("<p align=center>Your Song Successfully sent.</p>");
		
		}
		print("<SCRIPT>

function validateForm(form) {  

if (form.name.value == '') {  
   alert('Name Field is Empty.');  
   form.name.focus( );  
   return false;  
   }

if (form.email.value == '') {  
   alert('Email Field is Empty.');  
   form.email.focus( );  
   return false;  
   }
   
 if (form.send_to.value == '') {  
   alert('Email Field is empty.');  
   form.send_to.focus( );  
   return false; 
   }
    if (form.message.value == '') {  
   alert('Message Field is empty.');  
   form.message.focus( );  
   return false;   
   }
}
</SCRIPT>");
		print("<form name='listing' action='".$this->thisfile."?action=mailfriend&send=yes&song=".$song_id."&album=".$album_id."&artist=".$artist_id."&genre=".$genre_id."' method='post' onSubmit='return validateForm(this)'>\n");
print("<title>Mail this Song</title>");
print("<link rel='stylesheet' href='template/css/theme.css' type='text/css'> ");
		print("<table style='width: 100%; border: 0px;'>\n");
		
{

			print("<td><b>Mail this Song </b></td><tr><td><span style='font-weight:bold;'>Your name:</span></td><td><input type='text' name='name'></td></tr>\n");
			print("<tr><td><span style='font-weight:bold;'>Your email:</span></td><td><input type='text' name='email'></td></tr>\n");
		}	
		$mail = $this->url."/";
		$info = "";
		if( $song_id != 0 ) {
			$query = "SELECT song.song_name, album.album_name, artist.name as artist_name FROM song, album, artist WHERE song.album_id = album.id AND song.artist_id = artist.id AND song.id = '".$song_id."'";
			$result = mysql_query($query);
			$row = mysql_fetch_assoc($result); 
			print("<tr><td><span style='font-weight:bold;'>Artist Name:</span></td><td>".$row['artist_name']."</td></tr>\n");
			print("<tr><td><span style='font-weight:bold;'>Album Name:</span></td><td>".$row['album_name']."</td></tr>\n");
			print("<tr><td><span style='font-weight:bold;'>Track Name:</span></td><td>".$row['song_name']."</td></tr>\n");
			$mail .= "listen.php?action=song&id=".$song_id;
			$info = "the song ".$row['song_name']." by ".$row['artist_name'];
		} else if( $album_id != 0 ) {
			$query = "SELECT album.album_name, artist.name as artist_name FROM album, artist WHERE album.artist_id = artist.id AND album.id = '".$album_id."'";
			$result = mysql_query($query) or die(mysql_error());
			$row = mysql_fetch_assoc($result);
			print("<tr><td><span style='font-weight:bold;'>Artist Name:</span></td><td>".$row['artist_name']."</td></tr>\n");
			print("<tr><td><span style='font-weight:bold;'>Album Name:</span></td><td>".$row['album_name']."</td></tr>\n");
			$mail .= "index.php?action=album&id=".$album_id;
			$info = "the album ".$row['album_name']." by ".$row['artist_name'];
		} else if( $artist_id != 0 ) {
			$query = "SELECT * FROM artist WHERE artist.id = '".$artist_id."'";
			$result = mysql_query($query);
			$row = mysql_fetch_assoc($result);
			print("<tr><td><span style='font-weight:bold;'>Artist Name:</span></td><td>".$row['name']."</td></tr>\n");
			$mail .= "index.php?action=artist&id=".$artist_id;
			$info = "the artist ".$row['artist_name'];
		} else if( $genre_id != 0 ) {
			$query = "SELECT genre.genre as genre_name FROM genre WHERE genre.id = '".$genre_id."'";
			$result = mysql_query($query);
			$row = mysql_fetch_assoc($result);
			print("<tr><td><span style='font-weight:bold;'>Genre Name:</span></td><td>".$row['genre_name']."</td></tr>\n");
			$mail .= "index.php?action=genre&id=".$genre_id;
			$info = "the genre ".$row['genre_name'];
		}
		
		print("<tr><td><span style='font-weight:bold;'>Email to:</span></td><td><input name='send_to' type='textbox' value='' ></td></tr>\n");
		print("<tr><td><span style='font-weight:bold;'>Message:</span></td><td>&nbsp;</td></tr>\n");
		print("<tr><td colspan='2'><textarea name='message'></textarea><input type='hidden' name='href' value='".$mail."'><input type='hidden' name='info' value='".$info."'></td></tr>\n");
		print("<tr><td colspan='2'><input name='submit' type='submit' value='Send it Now'></td></tr>\n"); 
		print("</table></form>\n");
	
	}
	
	function viewmailfriend() {
		$start = $_GET['start'];
		
		if( $start == "" ) {
			$start = 0;
		}
	
		$query = "SELECT * FROM mailfriend, song WHERE mailfriend.song_id = song.id ORDER BY song.id DESC LIMIT ".$start.",10";
		$result = mysql_query($query);
		$i = 1;
		while( $row = mysql_fetch_assoc($result) ) {
			$user = array();
			global $_SESSION; 
			if( $row['username'] != 0 ) {
				$user = $this->get_info($row['username']);
				print("<p><b><a href='mailto:".$user['email']."'><font color='#cc0033'>".$user['name']."</a></b></font> mailed <a href='mailto:".$row['sent_to']."'>".$row['sent_to']."</a><br>");
			} else {
				print("<p><b> ".$row['subject']."</b> mailed <a href='mailto:".$row['sent_to']."'>".$row['sent_to']."</a><br>");
			}
			print("<b>Track :</b> <b><a href='#' onClick=\"javascript:playSong(".$row['song_id'].")\">".$row['song_name']."</a></b><br><b>Message : </b>");
			print($this->InsertLinks($row['message'])."</p>");
			$i++;
		}
		if( $i == 1 ) { print("<p>Nobody has mailed a song.</p>"); }
		else if ( $i == 11 ) { print("<p style='text-align: right'>.: <a href='".$this->thisfile."?action=viewmailfriend&start=".($start+10)."'>View more</a></p>"); }
	
	}
	 
	function InsertLinks ( $Text )
	{
	//  First match things beginning with http:// (or other protocols)
	   $NotAnchor = '(?<!"|href=|href\s=\s|href=\s|href\s=)';
	   $Protocol = '(http|ftp|https):\/\/';
	   $Domain = '[\w]+(.[\w]+)';
	   $Subdir = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
	   $Expr = '/' . $NotAnchor . $Protocol . $Domain . $Subdir . '/i';

	   $Result = preg_replace( $Expr, "<a href=\"$0\" title=\"$0\" target=\"_blank\">$0</a>", $Text );
	
	//  Now match things beginning with www.
	   $NotAnchor = '(?<!"|href=|href\s=\s|href=\s|href\s=)';
	   $NotHTTP = '(?<!:\/\/)';
	   $Domain = 'www(.[\w]+)';
	   $Subdir = '([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
	   $Expr = '/' . $NotAnchor . $NotHTTP . $Domain . $Subdir . '/i';

	   return preg_replace( $Expr, "<a href=\"http://$0\" title=\"http://$0\" target=\"_blank\">$0</a>", $Result );
	} 
	
	/********** Top X Functions **********/
	function topx() {
	
		$sortby = addslashes($_POST['sort']);
		$show = addslashes($_GET['show']);
		$type = addslashes($_GET['type']);
		$genre_id = addslashes($_GET['genre']);
		
		if( $type == '' ) {
			print("<p>Possible usage (replace number by show by any number doesn't just have to be 5)</p>");
			print("<p>Top 5 Artists<br><a href='".$this->thisfile."?action=top&show=5&type=Artists'>".$this->thisfile."?action=top&show=5&type=Artists</a><br>");
			print("Also you can display specific by just saying genre id number <a href='".$this->thisfile."?action=top&show=5&type=Artists&genre=1'>".$this->thisfile."?action=top&show=5&type=Artists&genre=1</a></p>");
			print("<p>Top 5 Songs<br><a href='".$this->thisfile."?action=top&show=5&type=Songs'>".$this->thisfile."?action=top&show=5&type=Songs</a><br>");
			print("Also you can display specific by just saying genre id number <a href='".$this->thisfile."?action=top&show=5&type=Songs&genre=1'>".$this->thisfile."?action=top&show=5&type=Songs&genre=1</a></p>");
			print("<p>Top 5 Albums<br><a href='".$this->thisfile."?action=top&show=5&type=albums'>".$this->thisfile."?action=top&show=5&type=albums</a><br>");
			print("Also you can display specific by just saying genre id number <a href='".$this->thisfile."?action=top&show=5&type=albums&genre=1'>".$this->thisfile."?action=top&show=5&type=albums&genre=1</a></p>");
			print("<p>Top 5 Genres<br><a href='".$this->thisfile."?action=top&show=5&type=Genres'>".$this->thisfile."?action=top&show=5&type=Genres</a></p>");
			return;
		}
		
		// Display Title
		print("<div id='title'><h1>Top ".$show);
		if( $genre_id != '' ) {
			$query = "SELECT * FROM genre WHERE id ='".$genre_id."'";
			$result = mysql_query($query);
			$genre = mysql_fetch_assoc($result);
			print(" Most Popular ".$type." in ".$genre['genre']."</h1></div>\n");
		} else {
			print(" Most Popular ".$type."</h1></div>\n");
		}
		
		//$this->sortby("action=top&show=".$show."&genre=".$genre_id."&type=".$type);
		
		// Query
		if( $genre_id != "" ) {
			$where = "album.genre_id = '".$genre_id."' AND ";
		}
		if( $type == "albums" ) {
			$query = "SELECT album.id as album_id, SUM(song.plays) as total_plays, TO_DAYS(now())-TO_DAYS(album.post_date)as date_diff, COUNT(song.id) as total_songs, AVG(song.rating/song.num_rating) as average_rating, album.album_name as album, album.id as album_id, artist.id as artist_id, artist.name AS artist_name FROM song, album, artist WHERE ".(($genre_id!="")?$where:"")."album.id = song.album_id AND artist.id = song.artist_id GROUP BY song.album_id ORDER BY Total_Plays DESC, album.album_name ASC";
		} else if( $type == "Artists" ) {
			$query = "SELECT SUM(song.plays) as total_plays, COUNT(song.id) as total_songs, AVG(song.rating/song.num_rating) as average_rating, artist.id AS artist_id, artist.name as artist_name FROM song, artist, album WHERE ".(($genre_id!="")?$where:"")."album.id = song.album_id AND artist.id = song.artist_id GROUP BY song.artist_id ORDER BY Total_Plays DESC, artist.name ASC";
		} else if( $type == "Songs" ) {
			$query = "SELECT SUM(song.plays) as total_plays, AVG(song.rating/song.num_rating) as average_rating, song.id as song_id, song.lyric_id as lyric_id, song.lyrics_approved as lyrics, song.song_name as song_name, album.album_name as album_name, artist.name AS artist_name, artist.id as artist_id, album.id as album_id FROM song, album, artist WHERE ".(($genre_id!="")?$where:"")."album.id = song.album_id AND artist.id = song.artist_id GROUP BY song.id ORDER BY Total_Plays DESC, song.song_name ASC";
		} else if( $type == "Genres" ) {
			$query = "SELECT SUM(song.plays) as total_plays, COUNT(song.id) as total_songs, COUNT(album.id) as total_albums, genre.genre AS genre_name, genre.id as genre_id FROM song, album, genre WHERE ".(($genre_id!="")?$where:"")."genre.id = album.genre_id AND album.id = song.album_id GROUP BY album.genre_id ORDER BY Total_Plays DESC, genre.genre ASC";
		}
		$result = mysql_query($query." LIMIT ".$show) or die(mysql_error());
		
		print("<form name='listing' action='".$this->thisfile."?action=launch' method='post'>\n");
		if( $type == "Songs" ) { $this->topButtons(); }
		print("<table border='0' style='width:100%'>\n");
		for( $i = 1 ; $row = mysql_fetch_assoc($result) ; $i++ ) {
			if( $type == "Albums" ) {
				print("<tr><td style='font-weight:bold; width:20px; text-align:center'>$i</span></td><td><a href='".$this->thisfile."?action=album&id=".$row['album_id']."'>".$row['album']."</a> <a href='#'><img src='images/".((round($row['average_rating'])<1)?'1':round($row['average_rating']))."_s.gif' alt='".round($row['average_rating'],2)."' border='0'></a> ".(($row['date_diff'] < 14)?"<img src='images/new.png' alt='New!'>":"")."</td><td style='text-align: right;' onClick='javascript:mailFriend(".$row['album_id'].",0,0,0)'><a href='#'>Mail a Friend <img src='images/mail.gif' alt='Mail a Friend' border='0'></a></td></tr>\n");
				print("<tr><td colspan='1'>&nbsp;</td><td colspan='1'><span style='font-weight:bold;'>Artist:</span> <a href='".$this->thisfile."?action=artist&id=".$row['artist_id']."'>".$row['artist_name']."</a></td></tr>\n");
				print("<tr><td colspan='1'>&nbsp;</td><td colspan='1'><span style='font-weight:bold;'>Total Songs:</span> ".$row['total_songs']."</td></tr>\n");
				print("<tr><td colspan='1'>&nbsp;</td><td colspan='1'><span style='font-weight:bold;'>Total Plays:</span> ".$row['total_plays']."</td></tr>\n");
			} else if( $type == "Artists" ) {
				print("<tr><td style='font-weight:bold; width:20px; text-align:center'>$i</span></td><td><a href='".$this->thisfile."?action=artist&id=".$row['artist_id']."'>".$row['artist_name']."</a> <img src='images/".((round($row['average_rating'])<1)?'1':round($row['average_rating']))."_s.gif' alt='".round($row['average_rating'],2)."' border='0'></td><td style='text-align: right;' onClick='javascript:mailFriend(0,".$row['artist_id'].",0,0)'><a href='#'>Mail a Friend <img src='images/mail.gif' alt='Mail a Friend' border='0'></a></td></tr>\n");
				print("<tr><td colspan='1'>&nbsp;</td><td colspan='1'><span style='font-weight:bold;'>Total Songs:</span> ".$row['total_songs']."</td></tr>\n");
				print("<tr><td colspan='1'>&nbsp;</td><td colspan='1'><span style='font-weight:bold;'>Total Plays:</span> ".$row['total_plays']."</td></tr>\n");
			} else if( $type == "Songs" ) {
				print("<tr><td style='width:20px; text-align:center'><input type='checkbox' name='song_id' value='".$row['song_id']."'></td><td style='font-weight:bold; width:20px; text-align:center'>$i</span></td><td><a href='#' onClick=\"javascript:playSong(".$row['song_id'].")\">".$row['song_name']."</

⌨️ 快捷键说明

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