1. Practice using the request object to accept data and comprehensively use some functions.
cnbruce.html
| <form action="cnbruce.asp" method="post"> <input type="text" name="title"><br> <textarea name="content" rows=10 cols=20></textarea><br> <input type="submit"> </form> |
cnbruce.asp
| <% function th(str) str=replace(str,"fuck","MD") str=replace(str,"dum","KAO") th=str end function function encode(str) str = replace(str, ">", ">") str = replace(str, "<", "<") str = Replace(str, CHR(32), "") str = Replace(str, CHR(13), "") str = Replace(str, CHR(10) & CHR(10), "</P><P>") str = Replace(str, CHR(10), "<BR>") encode=str end function %> <%title=request.form("title") content=request.form("content")%> Article title: <%=th(title)%><hr> Article content: <%=encode(th(content))%> |
th(str) is a custom function, and the main function is very simple: filter characters. encode(str) is also a custom function, and its main function is to fully display the passed information.
CHR(10) represents line break, CHR(13) represents carriage return, and CHR(32) represents space.
Additional function: Display UBB code.
That is, ubb.asp contains the ubb() function.
Enhanced cnbruce.asp
| <!--#include file="http://www.cnbruce.com/blog/ubb.asp"--> <% function th(str) str=replace(str,"fuck","MD") str=replace(str,"dum","KAO") th=str end function %> <script> function runEx(cod1) { cod=document.all(cod1) var code=cod.value; if (code!=""){ var newwin=window.open('','',''); newwin.opener = null newwin.document.write(code); newwin.document.close(); } } </script> <%title=request.form("title") content=request.form("content")%> Article title: <%=th(title)%><hr> Article content: <%=ubb(unhtml(th(content)))%> |