用排序串字段实现树状结构(例程——保存贴子内容)

程序名称:savelyb.asp
程序功能:保存贴子内容

 1   
 2posttype=request("posttype")   
 3pageno=request("pageno")   
 4keyid=request("keyid")   
 5if keyid="" then keyid=0   
 6emailpost=request("emailpost")   
 7guestitle=trim(request.form("guestitle"))   
 8guestname=trim(request.form("guestname"))   
 9guestcomm=rtrim(request.form("guestcomm"))   
10guestemail=request.form("guestemail")   
11emailflag=request.form("emailflag")   
12if guestitle="" or guestname="" then   
13call errmessage("

<center><br/><br/><font color="red" size="4">资料不完整,留言标题和姓名必须填写
</font><br/><br/><a href="javascript:history.back();">返回重填</a> <a href='index.asp?pageno="&amp;pageno&amp;"'>
放弃发表</a></center>

1")   
2response.end   
3end if   
4guestcomm=replace(guestcomm," "," ")   
5guestcomm=replace(guestcomm,chr(13),"

<br/>

 1")   
 2if emailflag="on" then   
 3temailflag=1   
 4else   
 5temailflag=0   
 6end if   
 7  
 8if session("guestitle")=guestitle then response.redirect "index.asp"   
 9set guestconn=Server.CreateObject("ADODB.connection")   
10guestconn.Open lybstr   
11set cm = Server.CreateObject("ADODB.Command")   
12Set cm.ActiveConnection = guestconn   
13cm.CommandText = "lybsave"   
14cm.CommandType = 4   
15set p = cm.Parameters   
16p.Append cm.CreateParameter("@keyid",3,1,4)   
17p.Append cm.CreateParameter("@guestname",202,1,20)   
18p.Append cm.CreateParameter("@guestitle",202,1,100)   
19p.Append cm.CreateParameter("@guestcomm",201,1,16000)   
20p.Append cm.CreateParameter("@guestemail",202,1,50)   
21p.Append cm.CreateParameter("@emailflag",17,1,1)   
22p.Append cm.CreateParameter("@fromip",202,1,15)   
23p.Append cm.CreateParameter("@recimail",202,2,50)   
24  
25cm("@keyid")=keyid   
26cm("@guestname")=guestname   
27cm("@guestitle")=guestitle   
28cm("@guestcomm")=guestcomm   
29cm("@guestemail")=ltrim(guestemail)   
30cm("@emailflag")=temailflag   
31cm("@fromip")=Request.ServerVariables("REMOTE_ADDR")   
32cm.execute   
33  
34  
35if trim(guestemail)="" then guestemail="[email protected]" '如果回复的用户没有填写Email地址,则使用版主Email地址   
36发信   
37if guestemail="[email protected] abc" then guestemail="[email protected]" '处理版主邮件地址   
38if cm("@recimail")<>"" then call posttome   
39call errmessage("

<center><br/><br/><font color="56abff" size="4">谢谢你的留言!<br/><br/></font><a href='index.asp?
pageno="&amp;pageno&amp;"'>阅读留言</a></center>

1")   
2session("guestitle")=guestitle   
3guestconn.close   
4set guestconn=nothing   
5response.end   
6  
7sub errmessage(message) 
 1<html>
 2<head><title>软件使用留言薄回复</title>
 3<style type="text/css">   
 4<!--   
 5a { text-decoration: none}   
 6body {line-height:18px;font-size:10.5pt;font-family:宋体}   
 7a:hover {color:#FF0000;text-decoration:none}   
 8\-->   
 9</style>
10</head>
11<body background="topbg.gif" topmargin="16">   

=message

1</body>
2</html>
1 end sub   
2  
3sub posttome   
4guestcomm=replace(guestcomm," "," ")   
5guestcomm=replace(guestcomm,"

<br/>

1","")   
2Set myMail = Server.CreateObject("CDONTS.NewMail")   
3myMail.From = guestemail   
4myMail.To = cm("@recimail")   
5myMail.Subject = guestitle&"—"&guestname   
6myMail.body =guestcomm & vbCrLf & vbCrLf & "软件使用留言薄 http://swuse.yeah.net"   
7myMail.Send   
8Set myMail=Nothing   
9end sub   
Published At
Categories with Web编程
Tagged with
comments powered by Disqus