|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
写软件都是想的时间比写的时间要长的.如果反过来了就得看看是什么原因了.另外大家可以回去问问公司里的小MM.(一般企业里,跟你们交付软件接触得最多的是她们)加密|数据ProblemwithQueryStringMethod
Oftentimeweusequerystringcollectiontoretrieveanuniquerecordfromatable.Noticethefollowing
pieceofcode-
Detail.asp?RecordID=200
Herewearepassingaquerystringvaluecalled"RecordID"usingtheurl.WethenusetheQueryString
collection"RecordID"togettheactualnumber-
<%
DimRecordID
RecordID=Request.QueryString("RecordID")
%>
Theproblemwiththeabovemethodisthatweareexposing"RecordID"tothepublic.Hencemakingeasyto
hackerstojustchangetheRecordIDQuerystringtoretrieveothervaluesofthetable.
Solutiontotheaboveproblem
Inordertosolvetheaboveproblem,wewillusetwoASPpagesandtheASPrandomnumberfunctionto
scramblethepassingquerystringvaluesothattherealrecordnumberisnotexposedtoothers.
Onthefirstpagewegetarandomnumberwiththefollowingcode-
<%
Randomizetimer
Randomizingthetimerfunction
rndNum=abs(int((rnd()*3001)))
Togenerateaprimebased,non-negativerandomnumber..
rndNum=rndNum+53
Session("rndNum")=rndNum
Weplacetherandomnumbervalueinasessionvariablesothatwecanuseitagaininthenextpage%>
Nowthatwehaveourrandomnumberwewillscrambleourquerystringwithit!Hereishow-
<%
Assumingyouhavearecordsetretrieved-
Display_Rs.movefirst
WhilenotDisplay_Rs.Eof
Response.Write"<ahref=detail.asp?RecordID="
Response.Write(Display_Rs("RecordID")*rndNum)
Noticewearemultiplyingtheactualrecordnumberwiththerandomnumbertoscramblethequerystring
Response.WriteDisplay_Rs("RecordID")&"</a>"
Display_Rs.Movenext
Wend
%>
Inthenextpagewewillun-scramblethequerystring!Hereishow-
<%
DimRecordID
RecordID=request.querystring("RecordID")/Session("rndNum")
WearedividingtherecordIDquerystringvaluewiththesameformulatoun-scrambleandpassthe
actualrecordIDtotheSQLstatement
Session.abandon
ReleasingSessionvalueforthenextrecord
%>
Thatsit!Usingtheabovemethodyoucanscrambleaquerystringasmuchasyoulike.Forexample
multiplytherandomnumberwithaverycomplexformulatogenerateanevenmoredifficultintegernumber.
Thekeypointhereisyoudividethenumberwiththesameformulayieldingtotheoriginalvalue.This
techniqueisnotfullproofbutmuchmoredifficulttobreakinthatpassingaregularquerystringvalue.</p>Access是一种桌面数据库,只适合数据量少的应用,在处理少量数据和单机访问的数据库时是很好的,效率也很高。但是它的同时访问客户端不能多于4个。access数据库有一定的极限,如果数据达到100M左右,很容易造成服务器iis假死,或者消耗掉服务器的内存导致服务器崩溃。 |
|