發言: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>