?? gb_save.asp
字號:
<%@ Language=VBScript %>
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="guest_lib.asp" -->
<%
FUNCTION txtToURL(tekst)
Tekst_temp = tekst
Tekst_temp = Replace(Tekst_temp,"<","<")
Tekst_temp = Replace(Tekst_temp,">",">")
Tekst_temp = Replace(Tekst_temp,"chr(13)","<BR>")
Tekst_temp = Replace(Tekst_temp,"#","<BR>")
Tekst_temp = Replace(Tekst_temp,Chr(13),"<BR>")
Tekst_temp = Replace(Tekst_temp,"[","<B>")
Tekst_temp = Replace(Tekst_temp,"]","</B>")
i = 1
While not InStr(i,Tekst_temp,"{") = 0
start = CInt( InStr(1,Tekst_temp,"{") )
i = start
slutt = CInt( InStr(start,Tekst_temp,"}") )
hole = mid(Tekst_temp,(start),(slutt-start+1))
if InStr(hole,"$") then
skille = CInt( InStr(start,Tekst_temp,"$") )
navn = mid(Tekst_temp,(start+1),(skille-start-1))
link = mid(Tekst_temp,(skille+1),(slutt-skille-1))
if Left(link,4) = "www." then
link = "http://" & link
end if 'www
if not InStr(link,"@") = 0 then
link = "mailto:" & link
end if '@
out_var = "<A HREF=""" & link & """>" & navn & "</A>"
Tekst_temp = Replace(Tekst_temp,hole,out_var,1,1)
else
link = mid(Tekst_temp,(start+1),(slutt-start-1))
if Left(link,4) = "www." then
link = "http://" & link
end if 'www
if not InStr(link,"@") = 0 then
link = "mailto:" & link
end if '@
link = "<A HREF=""" & link & """>"
Tekst_temp = Replace(Tekst_temp,"{",link,1,1)
Tekst_temp = Replace(Tekst_temp,"}","</A>",1,1)
end if
wend
txtToURL = Tekst_temp
END FUNCTION
dim ASPBook
dim StrSQL
dim BookPassWord
if isempty(Request("from")) then
MESSAGE("<li>對不起,沒有操作請求,因此不能使用。</li>")
Response.End
end if
if Request.Form("from") = "SaveData" then
dim BookName,Booksex,Bookplace,BookContent,BookMsgicon,Bookemail,Bookoicq,Bookicq,Bookurl
BookName =Request.Form("name")
Booksex =Request.Form("sex")
Bookplace =Request.Form("place")
BookContent =Request.Form("Content")
BookMsgicon =Request.Form("Msgicon")
Bookemail =Request.Form("email")
Bookoicq =Request.Form("oicq")
Bookicq =Request.Form("icq")
Bookurl =Request.Form("url")
BookD_Date =Request.Form("D_Date")
BookContent = txtToURL(BookContent)
if trim(BookName) = "" or trim(BookContent) = "" then
MESSAGE("<li>對不起,你還沒完全留言下所需信息,名字和留言是必須要的。</li>")
Response.End
end if
if trim(Bookoicq)<>"" then
if not(isnumeric(Bookoicq)) then
MESSAGE("OICQ號碼必須是數字!")
Response.End
end if
end if
if trim(Bookicq)<>"" then
if not(isnumeric(Bookicq)) then
MESSAGE("ICQ號碼必須是數字!")
Response.End
end if
end if
if trim(Bookemail)<>"" then
if instr(Bookemail,"@")<=1 then
MESSAGE("對不起,你的E-Mail地址有錯誤,因此不能發表留言,請核對后再試。")
Response.End
else
aemail=right(Bookemail,len(Bookemail)-instr(Bookemail,"@"))
bemail=right(Bookemail,len(Bookemail)-instr(Bookemail,"."))
if len(aemail)<=1 then
MESSAGE("<li>對不起,你的E-Mail地址有錯誤,因此不能發表留言,請核對后再試。")
Response.End
end if
if instr(aemail,".")=0 then
MESSAGE("<li>對不起,你的E-Mail地址有錯誤,因此不能發表留言,請核對后再試。")
Response.End
end if
if len(bemail)<=1 then
MESSAGE("<li>對不起,你的E-Mail地址有錯誤,因此不能發表留言,請核對后再試。")
Response.End
end if
end if
end if
Response.Cookies("UserInfo")("BookName")= trim(Request.Form("name"))
Response.Cookies("UserInfo")("Bookemail")=trim(request.form("email"))
Response.Cookies("UserInfo")("Bookurl")= trim(request.form("url"))
Response.Cookies("UserInfo")("Bookoicq")= trim(request.form("oicq"))
Response.Cookies("UserInfo")("Bookicq")= trim(request.form("icq"))
Response.Cookies("UserInfo")("Booksex")= trim(request.form("sex"))
Response.Cookies("UserInfo")("Bookplace")=trim(request.form("place"))
Response.Cookies("User").Expires= dateAdd("d", 30, now)
IPinfo = Request.servervariables("REMOTE_ADDR")
Set bc = Server.CreateObject("MSWC.BrowserType")
StrSQL = "Select * from guest where [隨機]='" & Request("D_Date") & "'"
Set rs2 = conn.Execute(StrSQL)
If rs2.EOF = True Then
Set ASPBook = Server.CreateObject("ADODB.RecordSet")
ASPBook.Open "guest",conn,3,3
ASPBook.addnew
ASPBook("名字") = Server.HtmlEncode(BookName)
ASPBook("來自") = Server.HtmlEncode(Bookplace)
ASPBook("郵件") = Server.HtmlEncode(Bookemail)
ASPBook("主頁") = Bookurl
ASPBook("表情") = BookMsgicon
ASPBook("性別") = Booksex
ASPBook("OICQ") = Bookoicq
ASPBook("ICQ") = Bookicq
ASPBook("留言") = BookContent
ASPBook("系統") = bc.browser + " " + bc.version + " " + bc.platform
ASPBook("IP") = IPInfo
ASPBook("隨機") = BookD_Date
ASPBook("留言日期") = cstr(now())
ASPBook.update
ASPBook.close
else
MESSAGE("<li>請不要重復提交你的留言!</li>")
Response.End
end if
conn.Close
Redirect "gb_view.asp?Page=1","謝謝你的留言!現在系統將自動返回。"
end if
if Request.Form("from") = "SaveReply" then '回復存盤
dim BookReply
BookPassWord = Request.Form("PassWord")
if BookPassWord<>PassWord then
MESSAGE("密碼不正確,因此不能回復,請核對后再試.")
Response.End
end if
Response.Cookies("UserInfo")("BookPassWord")=trim(request.form("PassWord"))
Response.Cookies("User").Expires= dateAdd("d", 1, now)
BookReply = Request.Form("Reply")
BookMsgicon = Request.Form("Msgicon")
Set ASPBook=Server.CreateObject("ADODB.RecordSet")
ASPBook.open "Select * from guest where ID = " & request("Number"),conn,3,3
if ASPBook.eof and ASPBook.bof then
MESSAGE("<li>操作錯誤,找不到序號為" & request("Number") & "的留言,因此不能進行回復操作!</li>")
Response.End
else
ASPBook("Reply") = TxtToURL(BookReply)
ASPBook("Reply_Icon") = BookMsgicon
ASPBook("Reply_Date") = cstr(now())
ASPBook.update
end if
ASPBook.close
set ASPBook=nothing
conn.close
set conn=nothing
Redirect "gb_view.asp?page=" & Request("page") & "","已成功的回復了該留言."
end if
if Request.Form("from") = "SaveDelete" then '刪除存盤
BookPassWord=request.form("PassWord")
if BookPassWord<>PassWord then
MESSAGE("<li>密碼不正確,因此不能刪除,請核對后再試。</li>")
Response.End
end if
Response.Cookies("UserInfo")("BookPassWord")=trim(request.form("PassWord"))
Response.Cookies("User").Expires= dateAdd("d", 1, now)
dim lngNumber
lngNumber=request("Number")
Set ASPBook=server.createobject("adodb.recordset")
StrSQL="Delete * from guest where ID = " & lngnumber
conn.Execute StrSQL
set ASPBook=nothing
conn.close
set conn=nothing
Redirect "gb_view.asp?page=" & Request("page") & "","已成功的刪除了該留言."
end if
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -