<!-- #Include File="../Include/Channel_Music.asp" -->
<!-- #Include File="../Editor/UBB/Editor.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================
tit=login_username&"的点歌机"
dim musicname
dim m_emoney,m_power,words,Music_maxnum,send_true,Musicum,username
words=trim(request("words"))
types=Request.QueryString("types")
call DoWebHead(2,0)
'response.write "<link type='text/css' href='/Skin/Template_1.css' rel=stylesheet media='all' />"
sql="select emoney,power,name from AsaiMHMusicSong where hidden=1 and id="&iSpecialID
set rs=Cls.exec(sql,1)
m_emoney=rs("emoney")
MusicName=rs("name")
m_power=rs("power")
rs.close
Music_maxnum=Music_Mailnum
 
if types="chk" then
dim paymode,payrate,paynum,rssum
  sql="select username,power from AsaiMHUserData where username='"&trim(request("receiveuser"))&"'"
  set rs=Cls.exec(sql,1)
  if rs.eof then
      response.write Cls.js_put("alert(""错误提示：此人尚未注册，无法点歌给他（她）。"");window.opener=null;window.close();",1)
  rs.close
  end if

      sql="select count(id) from AsaiMHMusicMail where r_user='"&trim(request("receiveuser"))&"'"
    set rs=Cls.exec(sql,1)
    Musicum=rs(0)
    rs.close
    if Musicum > Music_maxnum then 
      response.clear
      response.write Cls.js_put("alert(""错误提示：对方的收歌箱已满，请等待对方清除多余的收歌单。"");window.opener=null;window.close();",1)
      response.end
    else
      sql="select count(id) from AsaiMHMusicMail where s_user='"&login_username&"'"
      set rs=Cls.exec(sql,1)
      Musicum=rs(0)
      rs.close
      if Musicum> Music_maxnum then 
      response.clear
      response.write Cls.js_put("alert(""错误提示：您的点歌箱已满，请清除多余的点歌单。"");window.opener=null;window.close();",1)
      response.end
      end if
    end if
    sql="select * from AsaiMHMusicSong where hidden=1 and id="&iSpecialID
  set rs=Cls.exec(sql,1)
  MusicName=rs("name")
  rs.close
  sql="select * from AsaiMHMusicMail where (id is null)"
  call Cls.exec(sql,-1)     
  rs.Open sql,conn,1,3
  rs.AddNew
  rs("s_user")=login_username
  rs("r_user")=trim(request("receiveuser"))
  rs("m_name")=MusicName
  rs("m_id")=iSpecialID
  rs("paynum")=0
  'rs("emoney")=m_emoney
  'rs("power")=m_power
  rs("words")=words
  rs("tim")=now()
  rs("isread")=false
  rs.Update 
  rs.close
  response.clear
  response.write Cls.js_put("alert(""提示：成功发送歌曲！"");window.opener=null;window.close();",1) 
 end if

%>
<script Language="JavaScript">
<!-- 
function Form1_Validator(theForm) 
{ 
  if (theForm.receiveuser.value == "") 
    { 
    alert("您想点给谁？"); 
    theForm.receiveuser.focus(); 
    return (false); 
    } 
  if (theForm.Words.value.length > 66) 
    { 
    alert("话也太多了些吧，至多66个字符！"); 
    theForm.Words.focus(); 
    return (false); 
    } 
  return (true); 
} 
//--></script>
<script language=javascript>
function do_accept(addaccept)
{
  if (addaccept!="")
  { document.write_frm.receiveuser.value=addaccept; }
}
</script>

<table border=0 width='100%' cellspacing=0 cellpadding=0 class=>
<tr>
<td colspan=2 class=td>&nbsp;<%response.write img_skin("m_user")%><%=login_username%>的点歌机<%response.write rssum%></td>
</tr>             
<form method="POST" name="write_frm" action="?types=chk&Id=<%=iSpecialID%>" onsubmit="return Form1_Validator(this)" >   
<tr class=tr>
<td width=120>&nbsp;&nbsp;点 歌 给：</td>
<td width=*><INPUT type=text name=receiveuser size=30 maxlength=20><=20<%response.write friend_select()%></td>
</tr>
<tr class=tr>
<td width=120>&nbsp;&nbsp;歌曲名称：</td>
<td width=*><INPUT type=text name=musicname value=<%=musicname%> size=60 maxlength=20></td>
</tr>
<%Response.Write ShowUBBEditor("write_frm","words","祝福话语","","Default","",560,200)%>
<tr class=tr>
  <td>&nbsp;&nbsp;所需权限：</td>
  <td><%response.write format_emoney_power(""&m_emoney&"",""&m_power&"",1)%></td>
  </tr>
<tr class=tr>
<td>&nbsp;&nbsp;付费说明：</td><td><font class=red>点播这首歌曲需要扣除您 <%response.write m_emoney%> 个金币</font></td>
          </tr>
<tr class=tr>
<td height=30 colspan=2 align=center><input type="submit"  value="送出歌曲" class=btn>&nbsp;&nbsp;<input type="reset"  value="重新填写" class=btn></td>
</tr>
</FORM>				
</table>
<%
set rs=nothing
'---------------------------------center end-------------------------------

Call Channel_End(0)
call DoWebEnd()

function friend_select()
  dim rsf,ttt,temp1
  temp1=vbcrlf&"<select name=friend_select size=1 onchange=""javascript:do_accept(this.options[this.selectedIndex].value);"">" & _
	vbcrlf&"<option value='' class=bg_td>选择我的好友</option>"
  set rsf=Cls.exec("select username2 from AsaiMHuserfriend where username1='"&login_username&"' order by id",1)
  do while not rsf.eof
    ttt=rsf(0)
    temp1=temp1&vbcrlf&"<option value='"&ttt&"'>"&ttt&"</option>"
    rsf.movenext
  loop
  rsf.close
  set rsf=nothing
  temp1=temp1&vbcrlf&"</select>"
  friend_select=temp1
end function
%>