人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

再談SQL注入入侵動網SQL版-ASP TO HTML WITH TEMPLATE(3)

再談SQL注入入侵動網SQL版-ASP TO HTML WITH TEMPLATE(3)

更新時間:2022-07-26 文章作者:未知 信息來源:網絡 閱讀次數:


5,處理數據功能顯示頁面addit.asp首先是處理接受過來的數據,并將值寫入數據庫;接著將模板代碼進行引用,并將其中特殊代碼轉換為接受值,最終通過FSO生成HTML頁面。其中需要注意的還有,生成文件的路徑地址保存至數據庫表。<%'容錯處理On Error Resume Next%><!--#include file="conn.asp" --><!--#include file="lib.asp" --><%'接受傳遞值c_title=request.form("c_title")c_content=request.form("c_content")%><%'生成HTML文件名,建立文件夾,指定文件路徑fname = makefilename(now()) 'makefilename為自定義函數 folder = "newsfile/"&date()&"/"filepath = folder&fname%><%'將接受值及路徑保持至數據庫表sql = "Select * from c_news"Set rs = Server.CreateObject ("ADODB.Recordset")rs.Open sql,conn,3,2rs.addnewrs("c_title")=c_titlers("c_content")=c_contentrs("c_filepath")=filepathrs.updaters.close Set rs = Nothing%><%'打開模板代碼,并將其中特殊代碼轉變為接受值sql1="select m_id,m_html from c_moban where m_id=1"set rs1=Server.CreateObject("adodb.recordset")rs1.open sql1,conn,1,1mb_code=rs1("m_html")rs1.closeset rs1=nothingconn.closeset conn=nothingc_title=htmlencode(c_title)c_content=htmlencode(c_content)mb_code=replace(mb_code,"$cntop$",now())mb_code=replace(mb_code,"$cnleft$",c_title)mb_code=replace(mb_code,"$cnright$",c_content)%><%'生成HTML頁面Set fso = Server.CreateObject("Scripting.FileSystemObject")fso.CreateFolder(Server.MapPath(folder))Set fout = fso.CreateTextFile(Server.MapPath(filepath))fout.WriteLine mb_codefout.close%>文章添加成功,<a href="showit.asp">瀏覽</a>
[Ctrl+A 全部選擇 然后拷貝]6,顯示數據庫表記錄,并做指向HTML頁的鏈接:showit.asp<!--#includefile="conn.asp" --><!--#include file="lib.asp" --><%Set rs = Server.CreateObject ("ADODB.Recordset")sql = "Select * from c_news order by c_id desc"rs.Open sql,conn,1,1%><%if rs.EOF and rs.BOF then response.write ("暫時還沒有文章,<ahref=add.html>添加</a>")else Do Until rs.EOF%> <table width="758" border="0" align="center" cellpadding="3"cellspacing="1" bgcolor="#000000"> <tr> <td width="159"align="right" bordercolor="#CCCCCC"bgcolor="#CCCCCC"><%=rs("c_time")%></td> <tdwidth="591" bordercolor="#f3f3f3" bgcolor="#f3f3f3"><ahref=<%=rs("c_filepath")%>target="a_blank"><%=rs("c_title")%></a></td></tr> <tr> <td valign="top" align="right"bordercolor="#ececec" bgcolor="#ececec">[<ahref=del.asp?c_id=<%=rs("c_id")%>>Dell</a>][<ahref=change.asp?c_id=<%=rs("c_id")%>>Edit</a>][<ahref="add.html">Add</a>]</td> <td valign="top"bordercolor="#FFFFFF"bgcolor="#FFFFFF"><%=htmlencode(rs("c_content"))%></td></tr> </table><br><% rs.MoveNext Loopend if%><%rs.close Set rs = Nothingconn.close set conn=Nothing%> [Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]7,修改數據內容頁chang.asp 修改數據內容,同時也需要修改更新對應的HTML頁面。修改其實就是重新生成文件,且文件名和之前一樣,類似文件的覆蓋。
<!--#include file="conn.asp" --><!--#include file="lib.asp" --><%id=request.querystring("c_id")%><%if request.form("submit")="change" thenc_title=request.form("c_title")c_content=request.form("c_content")c_id=request.form("c_id")c_filepath=request.form("c_filepath")Set rs = Server.CreateObject ("ADODB.Recordset")sql = "Select * from c_news where c_id="&c_idrs.Open sql,conn,3,2rs("c_title")=c_titlers("c_content")=c_contentrs("c_time")=now()rs.updaters.close Set rs = Nothing%><%'打開模板代碼,并將其中特殊代碼轉變為接受值sql1="select m_id,m_html from c_moban where m_id=1"set rs1=Server.CreateObject("adodb.recordset")rs1.open sql1,conn,1,1mb_code=rs1("m_html")rs1.closeset rs1=nothingconn.closeset conn=nothingc_title=htmlencode(c_title)c_content=htmlencode(c_content)mb_code=replace(mb_code,"$cntop$",now())mb_code=replace(mb_code,"$cnleft$",c_title)mb_code=replace(mb_code,"$cnright$",c_content)%><%'生成HTML頁面Set fso = Server.CreateObject("Scripting.FileSystemObject")Set fout = fso.CreateTextFile(Server.MapPath(c_filepath))fout.WriteLine mb_codefout.close%><%response.redirect("showit.asp")%><%end if%><%if id<>"" then Set rs = Server.CreateObject ("ADODB.Recordset") sql="select * from c_news where c_id="&id rs.Open sql,conn,1,1 c_id=rs("c_id") c_filepath=rs("c_filepath") c_title=rs("c_title") c_content=rs("c_content")end if%><form action="change.asp" method="post">Title:<input type="text" name="c_title" value=<%=c_title%>><br>Content:<br><textarea name="c_content" rows="8" cols="30"><%=c_content%></textarea><br><input type="submit" value="change" name="submit"><input type="reset" value="Reset"><input name="c_id" type="hidden" value="<%=id%>"><input name="c_filepath" type="hidden" value="<%=c_filepath%>"></form> [Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]8,刪除記錄頁del.asp同樣!刪除,除了刪除數據庫表中的記錄,與其對應的HTML頁面也需刪除。代碼如下: <!--#include file="conn.asp" --><%
c_id = request.querystring("c_id")
sql = "Select * from c_news where c_id="&c_id
Set rs = Server.CreateObject ("ADODB.Recordset")
rs.Open sql,conn,2,3filepath=rs("c_filepath")
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile(Server.mappath(filepath))
Set fso = nothingrs.delete
rs.close
Set rs = Nothing
conn.close
set conn=nothing
%><%response.redirect("showit.asp")%>四,其它功能模板管理頁面:不會每次都是打開數據庫表進行增加或者修改模板代碼吧,所以,管理代碼的頁面程序不能少了,自己搗鼓下應該很簡單的。當然,之前管理員的登錄認證程序就不在書中交代了:)還有,如果設計了多個模板,那么在發表信息的時候應添加模板選擇單選框,同樣在執行轉換HTML時,SQL選擇的不同m_id了。不管怎么說,先把這些技術自己調試感受下。多多操作,相信“讀書千遍,其意自見”。調試地址: www.cnbruce.com/test/asp2html/showit.asp文件下載: www.cnbruce.com/test/asp2html/asp2html.rar

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 岳西县| 辰溪县| 中江县| 灵宝市| 公安县| 慈溪市| 砚山县| 钦州市| 津市市| 哈巴河县| 都兰县| 勃利县| 无棣县| 周宁县| 汝州市| 肥城市| 泰安市| 吴堡县| 呼图壁县| 诸暨市| 阳城县| 晋宁县| 郓城县| 临汾市| 灵武市| 措勤县| 许昌县| 香河县| 瓦房店市| 鄱阳县| 牙克石市| 青州市| 富川| 济阳县| 呼伦贝尔市| 庆阳市| 清水河县| 阿合奇县| 大新县| 石渠县| 巴楚县|