t0nsha's留言板 v1.0

本留言板以ASP编写,需要FSO组件支持,最大的特点就是简单易用。她采用单文本文件(Content.txt,第一次留言后产生)来保存留言,程序本身(MsgBoard.asp,文件名请勿随意修改)也只有一个文件,可将最近发表的留言显示在最上面,适合于像我一样的初学者学习,希望你喜欢。版权没有,翻版不究。^_^

 


< center >
  
< h2 >< a href = " http://blog.csdn.net/t0nsha/ "  target = " _blank " > t0nsha </ a > ' s<a href="#留言">留言</a>板 v1.0 </h2>
</ center >
< hr color = " #00FF00 " >

< %
' Get the total lines of a file.
Function  GetLine (filename)
   
Const  ForReading  =   1 , ForWriting  =   2
   
Dim  fso, f, ra
   
Set  fso  =  Server.CreateObject( " Scripting.FileSystemObject " )
   
Set  f  =  fso.OpenTextFile(filename, ForReading)
   ra 
=    f.ReadAll
   GetLine 
=  f.Line
   f.Close()
End Function
%
>

< %
' Show the file bottom up
Function     ShowRev(filename)
'     Set    fso=Server.CreateObject("Scripting.FileSystemObject")
'
    Set    f=fso.OpenTextFile(filename,1)
    i = GetLine(filename) - 1
    
While  i > 0
        i
= i - 3
        j
= i
        
Set  fso = Server.CreateObject( " Scripting.FileSystemObject " )
        
Set  f = fso.OpenTextFile(filename, 1 )
        
While  j > 0
            f.SkipLine()
            j
= j - 1
        
Wend
        
For  k = 1   To   3
            rl
= f.ReadLine()
            rl
= Server.HTMLEncode(rl)
            Response.Write(rl
& " <br> " )
        
Next
        f.Close()
    
Wend
End      Function     
%
>

< %
Dim     fso
Set     fso = CreateObject ( " Scripting.FileSystemObject " )
If     Request.Form( " szName " =   ""   Then
    Response.Write ( 
" <font color='#FF0000'> " & " 昵称不能为空! " & " </font> " & " <br> " )
ElseIf     Request.Form( " szContent " =   ""   Then
    Response.Write (
" <font color='#FF0000'> " & " 内容不能为空! " & " </font> " & " <br> " )
Else
    
If      Not     fso.FileExists(Server.MapPath( " Content.txt " ))  Then     
        
Set     fil = fso.CreateTextFile(Server.MapPath( " Content.txt " ), True     )
    
Else     
        
Set     fil = fso.OpenTextFile(Server.MapPath( " Content.txt " ), 8 )
    
End   If
    fil.WriteLine(
Now   &   "  来自: "   &  Request.ServerVariables( " REMOTE_ADDR " &   "  的  "   &  Request.Form( " szName " &   "  说: " )
    fil.WriteLine(Request.Form(
" szContent " ))
    fil.WriteBlankLines(
1 )
    fil.Close
End      If
If     fso.FileExists(Server.MapPath( " Content.txt " ))     Then
Call  ShowRev(Server.MapPath( " Content.txt " ))    
End   If
%
>

< hr color = " #00FF00 " >

< form name = " form1 "  method = " post "  action = " MsgBoard.asp " >
  昵称(限字20):
< input type = " text "  maxlength = 20  size = ' 20%' name="szName"><br>
  内容(限字80): < input type = " text "  maxlength = 80  size = ' 80%' name="szContent">
   < input type = " submit "  name = " Submit "  value = " 发表留言 " >
</ form >

< a name = " #留言 " ></ a >

 

下载地址1:http://down.chinaz.com/soft/21102.htm

下载地址2:http://www.fs2you.com/files/2167af14-9c93-11dc-8f79-00142218fc6e/ 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值