
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<!--#include file="inc/Email.asp"-->
<%
dim id,flashname
id=checkstr(request("id"))
flashname=checkstr(request("flashname"))

if not isinteger(id) then
  call mb("对不起，请指定要点歌的Flash！","index.asp",1)
end if
if flashname="" then
 call mb("Flash名称丢失！","index.asp",1)
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>闪游吧 - Flash点播</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body background="images/bg.gif" leftmargin="0" topmargin="0">
<br>

<TABLE width="275" border=0 align="center" cellPadding=0 cellSpacing=0 borderColor=#000000>
  <TR> 
    <TD background="images/T_back.gif" width="27%"><IMG src="images/T_1.gif" width=90 height=24 border="0"></TD>
    <TD background="images/T_back.gif" width="61%"><font color="#CC3300"><%if request("action")="save" then%>点播成功<%else%>为好友点播Flash<%end if%></font></TD>
    <TD width="12%"><IMG height=24 src="images/T_2.gif" width=29></TD>
  </TR>
</TABLE>
<%
if request("action")="save" then
  dim to_name,to_email,from_name,from_email,from_where,from_homepage,wish_title,wish_word,ishidden
  dim mailbody,mailtopic,sendmail
  
  to_name=checkstr(trim(request.form("to_name")))
  to_email=checkstr(trim(request.form("to_email")))
  from_name=checkstr(trim(request.form("from_name")))
  from_email=checkstr(trim(request.form("from_email")))
  from_where=checkstr(trim(request.form("from_where")))
  from_homepage=checkstr(trim(request.form("from_homepage")))
  wish_title=checkstr(trim(request.form("wish_title")))
  wish_word=checkstr(trim(request.form("wish_word")))
  ishidden=request.form("ishidden")
  
  if to_name="" or strlength(to_name)>20 then
    call mb("对不起，您要送出的对象不能为空或大于10个汉字！","",0)
  end if
  if not isemail(to_email) then
    call mb("对不起，您朋友的信箱不正确！","",0)
  end if
  
  if from_name="" or strlength(from_name)>20 then
    cal mb("对不起，您的大名不能为空或大于10个汉字！","",0)
  end if
  
  if from_where="" then
    call mb("请输入您来自哪里！","",0)
  end if
  if not isemail(from_email) then
    call mb("对不起，您的信箱不正确！","",0)
  end if
  
  if wish_title="" then
    call mb("请选择祝福短语！","",0)
  end if
  
  if wish_word="" then
    call mb("您真的不想对您的好友说几句吗？","",0)
  end if
  if ishidden="" then
    ishidden=true
  else
    ishidden=false
  end if
set rs=server.createobject("adodb.recordset")
sql="select * from wish where id is null"
rs.open sql,conn,1,3

rs.addnew()
'添加祝福
rs("flash_name")=flashname
rs("flash_id")=id
rs("to_name")=to_name
rs("to_email")=to_email
rs("from_name")=from_name
rs("from_email")=from_email
rs("from_where")=from_where
rs("from_homepage")=from_homepage
rs("wish_title")=wish_title
rs("wish_word")=wish_word
rs("ishidden")=ishidden
rs("ispassed")=true
rs.update

rs.close:set rs=nothing
'发送邮件
mailtopic="一封来自"&sitename&"的祝福信！"
%>
<!--#include file="inc/email_word.asp"-->
<%
'
select case EmailSuport
  case 0
   '不支持邮件
  case 1
	call jmail(to_email,mailtopic,mailbody)
  case 2
	call Cdonts(to_email,mailtopic,mailbody)
 case 3
	call aspemail(to_email,mailtopic,mailbody)
end select

response.write "<script language=javascript>alert('恭喜您，您已经成功的送出了祝福！');</script>"

if SendMail="OK" then
  response.write "<script language=javascript>alert('系统提示：已经成功的向您的好友发送了邮件！');</script>"
else
  response.write "<script language=javascript>alert('系统提示：邮件系统错误您的好友未能收到我们发送的邮件！</script>"
end if

response.write "<script language=javascript>window.close();</script>"

else
%>
<table width="275" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <form name="wish" method="post" action="?action=save">
    <tr bgcolor="#FFFFFF"> 
      <td width="68" height="20" align="right" bgcolor="#FFFFFF">Flash名称:</td>
      <td width="204" height="20"><input name="flashname" type="text" class="input" id="flashname" value="<%=flashname%>" size="20" disabled>
      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="20" align="right" bgcolor="#FFFFFF">我要送给: </td>
      <td height="20"><input name="to_name" type="text" class="input" id="to_name" size="20" maxlength="20">
        [必填]</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="20" align="right" bgcolor="#FFFFFF">朋友信箱: </td>
      <td height="20"><input name="to_email" type="text" class="input" id="to_email" size="20">
        [必填]</td>
    </tr>
    <tr align="center" bgcolor="#FFFBFF"> 
      <td height="20" colspan="2">点播者信息 </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="20" align="right" bgcolor="#FFFFFF">您的名字: </td>
      <td height="20"><input name="from_name" type="text" class="input" id="from_name" size="20" maxlength="20">
        [必填]</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="20" align="right" bgcolor="#FFFFFF">来自何方: </td>
      <td height="20"><input name="from_where" type="text" class="input" id="from_where" size="20" maxlength="18">
        [必填]</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="20" align="right" bgcolor="#FFFFFF">您的信箱: </td>
      <td height="20"><input name="from_email" type="text" class="input" id="from_email" size="20">
        [必填]</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="20" align="right" bgcolor="#FFFFFF">您的主页: </td>
      <td height="20"><input name="from_homepage" type="text" class="input" id="from_homepage" value="http://" size="20">
      </td>
    </tr>
    <tr align="center" bgcolor="#FFFFFF"> 
      <td height="30" colspan="2">短祝福语: <select name="wish_title" size="1" class="input" id="wish_title">
          <option value="我好想你" selected>我好想你</option>
          <option value="接受我吗？">接受我吗？</option>
          <option value="心只有你">心只有你</option>
		  <option value="爱你一万年">爱你一万年</option>
		  <option value="非常感谢">非常感谢</option>
          <option value="生日快乐">生日快乐</option>
          <option value="心想事成">心想事成</option>
		  <option value="早生贵子">早生贵子</option>
          <option value="身体健康">身体健康</option>
          <option value="节日快乐">节日快乐</option>
          <option value="合作愉快">合作愉快</option>
          <option value="天天好心情">天天好心情</option>
        </select> </td>
    </tr>
    <tr align="center" bgcolor="#FFFBFF"> 
      <td height="20" colspan="2">您的祝福</td>
    </tr>
    <tr align="center" bgcolor="#FFFFFF"> 
      <td height="20" colspan="2"> <textarea name="wish_word" cols="30" rows="5" id="wish_word"></textarea> 
      </td>
    </tr>
    <tr align="center" bgcolor="#FFFFFF"> 
      <td height="25" colspan="2">点播信息发布在首页 
        <input name="ishidden" type="checkbox" id="ishidden" value="false" checked> </td>
    </tr>
    <tr align="center" bgcolor="#FFFFFF"> 
      <td height="25" colspan="2"><input name="flashname" type="hidden" id="flashname" value="<%=flashname%>">
        <input name="id" type="hidden" id="id" value="<%=id%>"> 
        <input name="Submit" type="submit" class="button" value="送出《<%=flashname%>》"> 
      </td>
    </tr>
  </form>
</table>
<%end if
call closeconn()
%>
</body>
</html>
