主题:  帮忙看下这个留言本代码。

Sync

职务:普通成员
等级:2
金币:2.5
发贴:624
注册:2002/5/4 10:50:49
#12002/7/15 21:37:54


<%@ Language=VBScript %>


<%
FUNCTION txtToURL(tekst)
Tekst_temp = tekst


Tekst_temp = Replace(Tekst_temp,"<","<")
Tekst_temp = Replace(Tekst_temp,">",">")
Tekst_temp = Replace(Tekst_temp,"chr(13)","
")
Tekst_temp = Replace(Tekst_temp,"#","
")

Tekst_temp = Replace(Tekst_temp,Chr(13),"
")
Tekst_temp = Replace(Tekst_temp,"[","")
Tekst_temp = Replace(Tekst_temp,"]","
")

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 = "" & navn & ""
    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 = ""
    Tekst_temp = Replace(Tekst_temp,"{",link,1,1)
    Tekst_temp = Replace(Tekst_temp,"}","
",1,1)
end if
wend

txtToURL = Tekst_temp
END FUNCTION


dim ASPBook
dim StrSQL
dim BookPassWord

if isempty(Request("from")) then
MESSAGE("
  • 对不起,没有操作请求,因此不能使用。
  • ")
    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("
  • 对不起,你还没完全留言下所需信息,名字和留言是必须要的。
  • ")
    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("
  • 对不起,你的E-Mail地址有错误,因此不能发表留言,请核对后再试。")
    Response.End
    end if
    if instr(aemail,".")=0 then
    MESSAGE("
  • 对不起,你的E-Mail地址有错误,因此不能发表留言,请核对后再试。")
    Response.End
    end if
    if len(bemail)<=1 then
    MESSAGE("
  • 对不起,你的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("
  • 请不要重复提交你的留言!
  • ")
    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("
  • 操作错误,找不到序号为" & request("Number") & "的留言,因此不能进行回复操作!
  • ")
    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("
  • 密码不正确,因此不能删除,请核对后再试。
  • ")
    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
    %>    

    不知道为什么,留言之后不能返回,是不是那里出错了?
    202.110.119.78/attin/new/enter/gbook/gb_view.asp 这里是我的留言本

    大家可以发发留言试试....
    帮忙看看啊



    大家好

    缺缺

    职务:管理员
    等级:8
    金币:41.0
    发贴:9620
    注册:2004/1/14 19:14:47
    #22002/7/15 21:45:35
    没有找到返回的代码~~

    不找到这个文件原来是什么。发上来看看。把整个文件夹发上来



    玫儿

    职务:普通成员
    等级:1
    金币:1.0
    发贴:173
    注册:2002/6/24 23:58:43
    #32002/7/15 22:45:50
    好乱



    helmet

    职务:版主
    等级:4
    金币:10.0
    发贴:1559
    注册:2004/1/30 15:59:27
    #42002/7/16 15:01:46
    加一句response.write ""

    当然要判断留言成功以后。



    Sync

    职务:普通成员
    等级:2
    金币:2.5
    发贴:624
    注册:2002/5/4 10:50:49
    #52002/7/16 18:56:05
    response.write ""

    这段加在那里?

    谢谢了。。。


    大家好