亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

ASP常用的幾個功能模塊

 更新時間:2006年09月18日 00:00:00   作者:  
1,經(jīng)常寫些系統(tǒng),那么一般都是從登錄程序開始,每接一個系統(tǒng)就寫一次登錄,好麻煩。

干脆直接做個登錄驗證函數(shù)吧,對我來說,大都情況可以勝任了:)
[code]
<%
Function chk_regist(requestname,requestpwd,tablename,namefield,pwdfield,reurl)dim cn_name,cn_pwdcn_name=trim(request.form(""&requestname&""))cn_pwd=trim(request.form(""&requestpwd&""))if cn_name="" or cn_pwd="" thenresponse.Write("<script language=javascript>alert(""請將帳號密碼填寫完整,謝謝合作。"");history.go(-1)</script>")end ifSet rs = Server.CreateObject ("ADODB.Recordset")sql = "Select * from "&tablename&" where "&namefield&"=''"&cn_name&"''"rs.open sql,conn,1,1if rs.eof thenresponse.Write("<script language=javascript>alert(""沒有該會員ID,請確認(rèn)有沒有被申請。"");history.go(-1)</script>")elseif rs(""&pwdfield&"")=cn_pwd then session("cn_name")=rs(""&namefield&"")response.Redirect(reurl)elseresponse.Write("<script language=javascript>alert(""提醒,您的帳號和密碼是不吻合。注意數(shù)字和大小寫。"");history.go(-1)</script>")end ifend ifrs.close Set rs = NothingEnd Function%>
[code]
參數(shù)說明:
chk_regist(requestname,requestpwd,tablename,namefield,pwdfield,reurl)

requestname 為接受HTML頁中輸入名稱的INPUT控件名
requestpwd 為接受HTML頁中輸入密碼的INPUT控件名
tablename 為數(shù)據(jù)庫中保存注冊信息的表名
namefield 為該信息表中存放用戶名稱的字段名
pwdfield 為該信息表中存放用戶密碼的字段名
reurl 為登錄正確后跳轉(zhuǎn)的頁

引用示例如下:
<%call chk_regist("b_name","b_pwd","cn_admin","cn_name","cn_pwd","admin.asp")%>

2,經(jīng)常有可能對某個事物進(jìn)行當(dāng)前狀態(tài)的判斷,一般即做一字段(數(shù)值類型,默認(rèn)值為0)
通過對該字段值的修改達(dá)到狀態(tài)切換的效果。那么,我又做了個函數(shù),讓自己輕松輕松。
<%Function pvouch(tablename,fildname,autoidname,indexid)dim fildvalueSet rs = Server.CreateObject ("ADODB.Recordset")sql = "Select * from "&tablename&" where "&autoidname&"="&indexidrs.Open sql,conn,2,3fildvalue=rs(""&fildname&"")if fildvalue=0 thenfildvalue=1elsefildvalue=0end ifrs(""&fildname&"")=fildvaluers.updaters.close Set rs = NothingEnd Function%>

參數(shù)說明:
pvouch(tablename,fildname,autoidname,indexid)

tablename 該事物所在數(shù)據(jù)庫中的表名
fildname 該事物用以表明狀態(tài)的字段名(字段類型是數(shù)值型)
autoidname 在該表中的自動編號名
indexid 用以修改狀態(tài)的對應(yīng)自動編號的值

引用示例如下:
<%dowhat=request.QueryString("dowhat")p_id=cint(request.QueryString("p_id"))if dowhat="tj" and p_id<>"" thencall pvouch("cn_products","p_vouch","p_id",p_id)end if%><%if rs("p_vouch")=0 then%>>推薦<%else%>>取消推薦<%end if%>

3,為很多中小企業(yè)寫站點(diǎn),一般產(chǎn)品展示是個大項目,那么做成的頁面也就不同。
要不就是橫排來幾個,要不就是豎排來幾個,甚至全站要翻來覆去的搞個好幾次,麻煩也很累。
索性寫個函數(shù)能緩解一下,于是就成了下面
<%function showpros(tablename,topnum,fildname,loopnum,typenum)Set rs = Server.CreateObject ("ADODB.Recordset")sql = "Select top "&topnum&" * from "&tablenamers.Open sql,conn,1,1if rs.eof and rs.bof thenresponse.Write("暫時無該記錄")elseresponse.Write("")for i=1 to rs.recordcountif (i mod loopnum=1) thenresponse.write" "end ifselect case typenumcase "1"response.Write(" ")response.Write(rs(""&fildname&""))response.Write(" ")response.Write("方式1之"&i&"記錄")''此處的“方式1”可以替換顯示為其余字段的值response.Write(" ")''如果字段比較多,繼續(xù)添加新個表格行來顯示response.Write("  ")case "2"response.Write(" ")response.Write(rs(""&fildname&""))response.Write(" ")response.Write(" ")response.Write("方式2之"&i&"記錄")response.Write(" ")response.Write("  ")end selectif (i mod loopnum=0) thenresponse.write" "end ifrs.movenextnextresponse.Write(" ")end ifrs.close Set rs = Nothingend function%>

參數(shù)說明:showpros(tablename,topnum,fildname,loopnum,typenum)
whichpro為選擇何類型的產(chǎn)品種類
topnum表示提取多少條記錄
fildname表示調(diào)試顯示的字段,具體應(yīng)用的時候可以省去該參數(shù),在函數(shù)內(nèi)部直接使用
loopnum表示顯示的循環(huán)每行的記錄條數(shù)
typenum表示循環(huán)顯示的方法:目前分了兩類,橫向并列、縱向并列顯示同一數(shù)據(jù)記錄行的不同記錄

引用示例如下:
<%if request.form("submit")<>"" thentopnum=request.form("topnum")loopnum=request.form("loopnum")typenum=request.form("typenum")elsetopnum=8loopnum=2typenum=1end if%><%call showpros("cn_products",topnum,"p_name",loopnum,typenum)%>

相關(guān)文章

最新評論