程序名稱:savelyb.ASP
程序功能:保存貼子內容
<!-- #include file="lybcon.inc" -->
<%
posttype=request("posttype")
pageno=request("pageno")
keyid=request("keyid")
if keyid="" then keyid=0
emailpost=request("emailpost")
guestitle=trim(request.form("guestitle"))
guestname=trim(request.form("guestname"))
guestcomm=rtrim(request.form("guestcomm"))
guestemail=request.form("guestemail")
emailflag=request.form("emailflag")
if guestitle="" or guestname="" then
call errmessage("<center><br><br><font size=4 color=red>資料不完整,留言標題和姓名必須填寫
</font><br><br><a href='Javascript:history.back();'>返回重填</a> <a href='index.ASP?pageno="&pageno&"'>
放棄發表</a></center>")
response.end
end if
guestcomm=replace(guestcomm," "," ")
guestcomm=replace(guestcomm,chr(13),"<br>")
if emailflag="on" then
temailflag=1
else
temailflag=0
end if
if session("guestitle")=guestitle then response.redirect "index.ASP"
set guestconn=Server.CreateObject("ADODB.connection")
guestconn.Open lybstr
set cm = Server.CreateObject("ADODB.Command")
Set cm.ActiveConnection = guestconn
cm.CommandText = "lybsave"
cm.CommandType = 4
set p = cm.Parameters
p.Append cm.CreateParameter("@keyid",3,1,4)
p.Append cm.CreateParameter("@guestname",202,1,20)
p.Append cm.CreateParameter("@guestitle",202,1,100)
p.Append cm.CreateParameter("@guestcomm",201,1,16000)
p.Append cm.CreateParameter("@guestemail",202,1,50)
p.Append cm.CreateParameter("@emailflag",17,1,1)
p.Append cm.CreateParameter("@fromip",202,1,15)
p.Append cm.CreateParameter("@recimail",202,2,50)
cm("@keyid")=keyid
cm("@guestname")=guestname
cm("@guestitle")=guestitle
cm("@guestcomm")=guestcomm
cm("@guestemail")=ltrim(guestemail)
cm("@emailflag")=temailflag
cm("@fromip")=Request.ServerVariables("REMOTE_ADDR")
cm.execute
if trim(guestemail)="" then guestemail="[email protected]" '如果回復的用戶沒有填寫Email地址,則使用版主Email地址
發信
if guestemail="[email protected] abc" then guestemail="[email protected]" '處理版主郵件地址
if cm("@recimail")<>"" then call posttome
call errmessage("<center><br><br><font color=56abff size=4>謝謝你的留言!<br><br></font><a href='index.ASP?
pageno="&pageno&"'>閱讀留言</a></center>")
session("guestitle")=guestitle
guestconn.close
set guestconn=nothing
response.end
sub errmessage(message) %>
<Html>
<head><title>軟件使用留言薄回復</title>
<style TYPE="text/CSS">
<!--
a { text-decoration: none}
body {line-height:18px;font-size:10.5pt;font-family:宋體}
a:hover {color:#FF0000;text-decoration:none}
-->
</style>
</head>
<body topmargin=16 background='topbg.gif'>
<% =message %>
</body>
</Html>
<% end sub
sub posttome
guestcomm=replace(guestcomm," "," ")
guestcomm=replace(guestcomm,"<br>","")
Set myMail = Server.CreateObject("CDONTS.NewMail")
myMail.From = guestemail
myMail.To = cm("@recimail")
myMail.Subject = guestitle&"—"&guestname
myMail.body =guestcomm & vbCrLf & vbCrLf & "軟件使用留言薄 http://swuse.yeah.net"
myMail.Send
Set myMail=Nothing
end sub
%>