午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    asp用戶登錄模塊實例代碼
    來源:易賢網(wǎng) 閱讀:1454 次 日期:2014-08-22 15:53:11
    溫馨提示:易賢網(wǎng)小編為您整理了“asp用戶登錄模塊實例代碼”,方便廣大網(wǎng)友查閱!

    asp用戶登錄模塊實例代碼:

    用戶登錄驗證腳本,Chkpwd.asp

    以下為引用的內(nèi)容:

    <%

    '=======用戶登錄驗證腳本=======

    '如果尚未定義Passed對象,則將其定義為false,表示沒有通過驗證

    If IsEmpty(Session("Passed")) Then

    Session("Passed")=false

    End If

    'Session("Passed")=False,表示尚未通過驗證,則開始讀取從表單傳來的驗證信息

    If Session("Passed")=False Then

    UserName=Request.Form("UserName")

    UserPwd=Request.Form("UserPwd")

    If UserName="" Then

    Errmsg="提示:請輸入用戶名和密碼"

    Else

    '===================連接數(shù)據(jù)庫=====================

    Set Conn= Server.CreateObject("ADODB.Connection")

    Conn.Connectionstring= "Driver={SQL Server};Server=192.168.1.3;UID=sa;PWD=;Database=zcmrs"

    Conn.open

    '===================從表log中讀取用戶數(shù)據(jù)=====================

    '定義RecordSet對象

    Set rs=Server.CreateObject("ADODB.Recordset")

    '設置Connection對象的ConnectionString

    Set rs.ActiveConnection=Conn

    '設置游標類型

    rs.CursorType=3

    '打開記錄集

    rs.Open "Select username,password from erpuser Where username='"&UserName&"'"

    '===================身份驗證======================

    If rs.EOF Then

    Errmsg="提示:用戶不存在或密碼錯誤"

    Else

    If UserPwd<>rs.Fields("password") Then

    Errmsg="提示:登錄失敗!密碼錯誤?"

    Else '登錄成功

    Errmsg=""

    Session("Passed")=True

    Session("UserName")=rs.Fields("username")

    '標識用戶權限 Session("UserID")=rs.Fields("UserID")

    End If

    End If

    End If

    End If

    '經(jīng)過登錄不成功,則畫出登錄表單

    If Not Session("Passed")=True Then

    %>

    <html>

    <head><title>無標題文檔</title>

    <style type="text/css">

    <!--

    .STYLE1 {font-size: 12px;font-weight:bold;margin-left:120px;outline:double}

    -->

    </style>

    <style type="text/css">

    <!--

    .STYLE2 {font-size: 12px;font-weight:bold;outline:double;color:#FF3333}

    -->

    </style>

    </head>

    <body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#000000">

    <div id=parent style="height:300;width:450;border-style:solid;border-color:#FFFFFF;margin-top:80px;margin-left:25%;margin-right:25%;background-color:#FFFFFF">

    <div id=denglu style="font-size:12px;font-weight:bold;background-color:#0099FF;text-align:center;height:40px;"><br>ERP系統(tǒng)登錄</div>

    <form action="<%=request.ServerVariables("path_info")%>" method="post" name="MyForm" id="MyForm">

    <p class="STYLE1">用戶名:<input name="UserName" type="text" id="UserName" size="18" maxlength="20">

    </p>

    <p class="STYLE1">密 碼:<input name="UserPwd" type="password" id="UserPwd" size="18" maxlength="20">

    </p>

    <p align="center" class="STYLE2"><%=Errmsg%> </p>

    <p> 

    <input type="submit" align="middle" name="Submit" value="登錄系統(tǒng)"> 

    <input name="rege" type="button" align="middle" onClick="location='register.asp'" id="rege" value="注冊用戶">

    </p>

    </form>

    </div>

    </body>

    </html>

    <%

    '<p class="STYLE1">驗證碼:<input name="CheckCode" type="text" id="CheckCode" size="6" maxlength="4">

    '<IMG style="MARGIN-RIGHT: 40px" alt="" src="common/getcode.asp"></p>

    response.End

    End If

    %>

    要訪問的頁面erp.asp

    <以下為引用的內(nèi)容:

    <!--#include file="chkpwd.asp"-->

    <body>

    <div style='font-size:12px;font-weight:bold;border:1px solid #001;padding:4px;background:#FFCCFF;margin-top:0;'>歡迎使用ERP查詢系統(tǒng),當前登錄用戶為:

    <%

    If Session("Passed")=True Then

    Response.Write(Session("UserName"))

    End If

    %><a href="logout.asp">退出系統(tǒng)</a>

    </div>

    </body>

    以上每次打開erp.asp的時候,都首先執(zhí)行Chkpwd.asp(),這樣可以有效防止未授權用戶訪問指定網(wǎng)頁.

    logout.asp系統(tǒng)退出

    <body>

    <%

    Session("Passed")=false

    Session("UserName")=""

    Response.Redirect("index.asp")

    %>

    </body>

    使用圖片提交表單

    以下為引用的內(nèi)容:

    <form name="form1" method="post" action="">

    <td align="right"><input type="image" method="submit" name="submit" src="image/loginin.gif" width="70" height="21" alt="submit"></td>

    </form>

    更多信息請查看IT技術專欄

    更多信息請查看網(wǎng)絡編程
    易賢網(wǎng)手機網(wǎng)站地址:asp用戶登錄模塊實例代碼

    2025國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網(wǎng)