|
技术资料 > ASP技术 > ASP技巧 : 排序方式解决“上下主题”问题(二) |
排序方式解决“上下主题”问题(二) March 25,2004 |
发言:add_massege.asp
------------部分,未经优化整理------------
<body bgcolor="#C8C8E6">
<script language="VBScript">
Sub GoBack()
form1.btn1.value="返回"
history.go(-1)
end sub
</Script>
<%
name1=Session("Uname")
If name1="" Then
Response.Write"<font size=3 color=blue><center>"
Response.Write"<br>"
Response.Write"<br>"
Response.Write"只有会员才能使用此项功能,请您注册或登录! <p>"
Response.Write"<a href=main1.htm>回上页</a>"
Response.End
End If
psw1=Session("Upsw")
orderid=Request("txtOrderid")
face=Request("R1")
level=Request("txtLevel")
name=Request("txtName")
psw=Request("txtPsw")
work=Session("Uwork")
add=Session("Uadd")
eee=Session("Unid")
mail=Request("txtMail")
subject=Request("txtSubject")
ip=Request.ServerVariables("Remote_Addr")
If name ="" OR psw ="" Then
Response.Write"<font size=5 color=blue><center>"
Response.Write"<br>"
Response.Write"<br>"
Response.Write"请填写你的名字/密码~ <p>"
%>
<form name=form1>
<input type="button" name="btn1" value="返回" onClick="GoBack">
</form>
<%
Response.End
End If
If name<>name1 Or psw<>psw1 Then
Response.Write"<font size=5 color=blue><center>"
Response.Write"<br>"
Response.Write"<br>"
Response.Write"您的名字/密码有错误,请仔细填写!~ <p>"
%>
<form name=form1>
<input type="button" name="btn1" value="返回" onClick="GoBack">
</form>
<%
Response.End
End If
If subject="" Then
Response.Write"<font size=5 color=blue><center>"
Response.Write"<br>"
Response.Write"<br>"
Response.Write"请填写您的发言主题~ <p>"
%>
<form name=form1>
<input type="button" name="btn1" value="返回" onClick="GoBack">
</form>
<%
Response.End
End If
IF orderid<>"" Then
j=Len(orderid)
mmm=Left(orderid,j-1)
Set conn = Server.CreateObject("ADODB.Connection")
DBPath=Server.MapPath("../fpdb/massege.mdb")
conn.Open"Driver={Microsoft Access Driver (*.mdb)};dbq="& DBPath
Set RS = conn.Execute("Select A_ID,A_OrderID From MASSEGE")
DO While not RS.EOF
nnn=RS("A_OrderID")
If Left(nnn,j-1)=mmm Then
aaa=Asc(Mid(nnn,j,1))
If aaa=122 Then
qqq=mmm+"a"+"z"
Else
qqq=mmm+Chr(aaa+1)+"z"
End If
End If
RS.MoveNext
Loop
RS.Close
conn.Close
Else
Set myconn = Server.CreateObject("ADODB.Connection")
DBPath=Server.MapPath("../fpdb/massege.mdb")
myconn.Open"Driver={Microsoft Access Driver (*.mdb)};dbq="& DBPath
SQLcmd1="Select * From MASSEGE Where A_Level = '0' Order By A_ID DESC"
Set RS = myconn.Execute(SQLcmd1)
nnn=RS("A_OrderID")
a=Asc(Left(nnn,1))
b=Asc(Mid(nnn,2,1))
c=Asc(Mid(nnn,3,1))
d=Asc(Mid(nnn,4,1))
e=Asc(Mid(nnn,5,1))
f=Asc(Mid(nnn,6,1))
%>
<%=Chr(a)%>11<%=Chr(b)%>22<%=Chr(c)%>33<%=Chr(d)%>44<%=Chr(e)%>55<%=Chr(f)%>66
<%
If f<122 Then
qqq=Chr(a)+Chr(b)+Chr(c)+Chr(d)+Chr(e)+Chr(f+1)+"z"
%>
<%=qqq%>77
<%
Else
If e<122 Then
qqq=Chr(a)+Chr(b)+Chr(c)+Chr(d)+Chr(e+1)+"az"
%>
<%=qqq%>88
<%
Else
If d<122 Then
qqq=Chr(a)+Chr(b)+Chr(c)+Chr(d+1)+"aaz"
%>
<%=qqq%>99
<%
End If
End If
End If
RS.Close
myconn.Close
End if
text=Server.HTMLEncode(Request("txtText"))
%>
<%=text%>
<%On error resume next
Set conn = Server.CreateObject("ADODB.Connection")
DBPath=Server.MapPath("../fpdb/massege.mdb")
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};dbq="& DBPath
SQLcmd = "Insert Into MASSEGE(A_OrderID,A_Level,A_Name,A_NID,A_Work,A_Add,A_Mail,A_Subject,A_Text,A_IP,A_Time)Values('"&qqq&"','"&level&"','"&name&"','"&eee&"','"&work&"','"&add&"','"&mail&"','"&subject&"','"&text&"','"&ip&"','"&now&"')"
conn.Execute SQLcmd
conn.Close
Response.Redirect"succ.htm"
%>
</body>
|
|