<?PHP
require_once("../include/conn.php");
require_once("../include/function.php");
require_once("../include/userset.php");
include "../include/emailadd.php";
$action = SafeRequest("action","get","zr");
$id = SafeRequest("id","get","zr");
if($action == "sendaction"){
	$username = $_POST['user'];
	$webname = S_SiteName;
	$title    = "".$username."在".$webname."给您点了一首非常好听的歌曲！";
	$Content = $_POST['Content'];
	$email = $_POST['email'];
        $smtp =   new smtp(S_Smtp,'25',true,S_Mailuser,S_Mailpass,S_Mail); 
        $send=$smtp->sendmail($email,S_Mail,$title,$Content,'HTML');
        if($send==1){
	   exit( "<script>alert('点歌成功!');window.close()</script>");
	}else{
	   exit( "<script>alert('点歌失败!');window.close()</script>");
	}
}
if(!IsNul($id)){echo "参数错误！";}
global $db;
$sql="Select S_ID,S_Name,S_ClassID from s_video where S_ID=".$id."";
$row=$db->getrow($sql);
if($row){
$name=$row['S_Name'];
$playurl=S_SiteDomain.LinkUrl("s_video",$row['S_ClassID'],1,$row['S_ID']);
}
else{
echo "<script>alert('抱歉，没有找到相关记录！');window.location='../';</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>点歌台_<?php echo S_SiteName?></title>
<link href="cms.css" rel="stylesheet" type="text/css" media="screen" />
</head>
  <div class="formbox">
<table width="100%" border="0" cellspacing="1" cellpadding="1"><tr> <td height="30" align="center"></td></tr> </table>
<form name="top_wz" onSubmit="return checkprice()" method="post" action="?action=sendaction">
<input name="action" type="hidden" value="sendaction" />
<table width="100%" border="0" cellspacing="2" cellpadding="1">
<tr> 
<td height="30" align="right" width="150">好友邮箱：</td>
<td height="30" align="left"><input name="email" type="text" class="ipt-txt" id="email" size=50 value="@"/></td>
</tr>
<tr> 
  <td height="30" align="right">歌曲信息：</td>
  <td height="30" align="left">
<textarea name="Content" cols="60" rows="6" id="Content" class="ipt-txt">

你好，我在 [<?php echo S_SiteName?>] 点了一首很好听的DJ送给你，希望你会喜欢！

舞曲名称是：《<?php echo $name?> 》       

网址是：<?php echo $playurl?>
</textarea></td>
</tr>
<tr> 
<td height="30" align="right" width="150">点歌人：</td>
<td height="30" align="left"><input name="user" type="text" class="ipt-txt" id="user" size=50 value=""/></td>
</tr>
<tr> 
<td height="85" align="left">&#160;</td>
<td height="85" align="left"><input type="submit" name="Submit_top_wz_edit" id="Submit_top_wz_edit" value="确定发送" /></td>
</tr>
</table>
</form>
<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#11161a"><tr> <td height="30" align="center"><a href="<?php echo S_SiteDomain?>" title="dj" target="_blank"><?php echo S_SiteName?>邮件点歌系统</a></td></tr> </table>

  </div>        

<p><bgsound balance="0" volume="-600" loop="infinite" src="dxy.mid"></bgsound></p>
</body>
</html>
<SCRIPT>
<!--
function checkprice() {
if( isNumberString(top_wz.email.value,"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@.-")!=1 || top_wz.email.value.length<8 || top_wz.email.value.indexOf('@', 0) == -1 || top_wz.email.value.indexOf('.', 0) == -1 ) {
alert("\友情提示：\n\n·请输入正确的联系邮箱")
document.top_wz.email.focus();
return false;
}
if( top_wz.user.value =="" ) {
alert("\友情提示：\n\n·请输入您的呢称")
document.top_wz.user.focus();
return false;
}
return true;
}
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
	TempChar= InString.substring (Count, Count+1);
	if (RefString.indexOf (TempChar, 0)==-1)  
	return (false);
}
return (true);
}
// -->
</SCRIPT>
