當前位置:編程學習大全網 - 源碼下載 - 急,十萬火急!如何用asp 做留言板的添加留言?和刪除留言?謝謝了,大神幫忙啊

急,十萬火急!如何用asp 做留言板的添加留言?和刪除留言?謝謝了,大神幫忙啊

這個是簡單的留言板代碼,數據庫就要妳自己設計了,網頁代碼是: <html> <head> <style> <!-- A:link, A:visited { text-decoration: none; color:#008040 } A:hover { text-decoration: underline; color: #ff0000 } --> </style> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=gb_2312-80"> <title>留言薄</title> </head> <%@ language="vbscript"%> <% Function Deal(exp1) dim exp2 exp2=Replace(exp1,"<","<") exp2=Replace(exp2,">",">") exp2=Replace(exp2,"'","''") exp2=Replace(exp2,Chr(13),"<br>") Deal=exp2 End Function '建立與數據庫的連接 Set Conn=Server.CreateObject("ADODB.Connection") Connstr="DBQ="+server.mappath("guestbook.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;ImplicitCommitSync=Yes;MaxBufferSize=512;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;" Conn.Open connstr If Request("task")="insert" then If Request("xm")="" then xm="不告訴妳" else xm=Request("xm") xm=Deal(xm) end if if request("email")="" then email="還沒有那" email=Deal(email) else email=Request("email") end if if request("url")="" then url="沒有" else url=Request("url") url=Deal(url) end if sj = Date() sj = sj & " " & Hour(Time()) & ":" & Minute(Time()) If Request("ly")="" then Response.write("請輸入留言!") Response.end else ly=Request("ly") ly=Deal(ly) end if sql="INSERT INTO lyb (ip,xm,url,email,sj,ly) VALUES ('" sql=sql & Request("REMOTE_ADDR") & "','" & xm & "','" & url & "','" & email & "','" & sj & "','" & ly & "')" conn.execute(sql) end if set rs=server.createobject("adodb.recordset") on error resume next rs.open "select * from lyb order by sj DESC",conn,1,1 rs.pagesize=15 rs.AbsolutePage =1 if request("page")<>"" then rs.AbsolutePage =Request("page") RowCount =rs.pagesize %> <body topmargin="0" leftmargin="2" text="#008000"> <p><font face="楷體_GB2312" color="#008000"><big><big><big><strong> 留言薄 </strong></big></big></big></font></p> <form METHOD="POST" action="<%=Request("SCRIPT_NAME")%>"> <input type="hidden" name="task" value="insert"><p> 姓名:<input TYPE="text" SIZE="20" NAME="xm"><br> 郵件:<input TYPE="text" SIZE="20" NAME="email"><br> 主頁:<input TYPE="text" SIZE="20" NAME="url"><br> 留言:<br> <textarea ROWS="5" COLS="60" NAME="ly"> </textarea></p> <p><input TYPE="submit" VALUE="記入留言薄" NAME="B1"> <input TYPE="reset" VALUE="重寫" NAME="B2"></p> </form> <hr> <% if not rs.eof then Do While Not RS.EOF and RowCount>0 %> <p>日期:<%=rs("sj")%><br> <% if rs("xm")<>"" then %> 姓名:<%=rs("xm")%><br> <% end if if rs("url")<>"" then %> 主頁:<a href="<%=rs("url")%>"><%=rs("url")%></a><br> <% end if if rs("email")<>"" then %> 郵件:<a href="mailto:<%=rs("email")%>"><%=rs("email")%></a><br> <% end if %> 留言:<br> <%=rs("ly")%></p> <hr> <% RowCount = RowCount - 1 rs.movenext loop else response.write("留言本空") end if %> <% if rs.pagecount>1 then %> <table border="0"> <tr> <td>留言分頁</td> <% for i=1 to rs.pagecount %> <td> <a href="<%=Request("Script_Name")%>?page=<%=i%>"><b><%=i%></b></a> </td> <%next%> </tr> </table> <% end if rs.close Set rs=nothing conn.close Set conn=nothing %> </body> </html>

  • 上一篇:Lol輔助tc源代碼
  • 下一篇:寫常用的knn算法,分別簡單介紹壹下。
  • copyright 2024編程學習大全網