<!--#include file="Include/Const.asp" -->
<!--#include file="Include/NoHackSql.Asp" -->
<!--#include file="Include/ConnSiteData.asp" -->
<%
Dim Action
Action = Request.QueryString("Action")
LiangjingCMSSubscribe = Trim(Request.Form("LiangjingCMSSubscribe"))
If LiangjingCMSSubscribe = "" Or LiangjingCMSSubscribe="请输入您的Email地址" Then
response.write "<script language=""JavaScript"">alert('请输入你的邮箱号？');" & "history.back()" & "</script>"
response.End
End If

If IsValidEmail(LiangjingCMSSubscribe)=false Then
response.write "<script language=""JavaScript"">alert('你输入的电子邮箱错误？');" & "history.back()" & "</script>"
response.End
End If 

Select Case Action
Case "Add"
set rs = server.createobject("adodb.recordset")
sql="select * from liangjing_Email where LiangjingCMS_EMail = '"&LiangjingCMSSubscribe&"'"
rs.open sql,conn,1,3
If rs.bof And rs.eof Then
rs.addnew
rs("LiangjingCMS_EMail") = LiangjingCMSSubscribe
rs("LiangjingCMS_PubTime") = Now()
rs.update
Else
response.write "<script language=""JavaScript"">alert('不好意思你的邮件已订阅？');" & "history.back()" & "</script>"
End If
rs.close
Set rs = Nothing
response.write "<script language=""JavaScript"">alert('恭喜你订阅成功');" & "history.back()" & "</script>"
Case "Del"
Error = True
set rs = server.createobject("adodb.recordset")
sql="select * from liangjing_Email where LiangjingCMS_EMail = '"&LiangjingCMSSubscribe&"'"
rs.open sql,conn,1,1
If rs.bof And rs.eof Then
error = False
End If
rs.close
Set rs = Nothing
If Error = True Then
conn.execute("delete from liangjing_Email where LiangjingCMS_EMail = '"&LiangjingCMSSubscribe&"'")
response.write "<script language=""JavaScript"">alert('退订成功！');" & "history.back()" & "</script>"
Else
response.write "<script language=""JavaScript"">alert('退订失败?');" & "history.back()" & "</script>"
End If
End Select
%>