Recommended: Interpret the usage of RegExp object function of asp RegExp objects provide simple regular expression support. Usage of RegExp object: The following is the referenced content: Function RegExpTest(patrn, strng) Dim re
User login verification script, Chkpwd.asp
| The following is the quoted content: <% '=========User login verification script======== 'If the Passed object has not been defined, it is defined as false, indicating that it has not passed the verification If IsEmpty(Session(Passed)) Then Session(Passed)=false End If 'Session(Passed)=False, which means that the verification information passed from the form has not been passed yet. If Session(Passed)=False Then UserName=Request.Form(UserName) UserPwd=Request.Form(UserPwd) If UserName= Then Errmsg=Tip: Please enter your username and password Else '=================================================== Set Conn= Server.CreateObject(ADODB.Connection) Conn.Connectionstring= Driver={SQL Server};Server=192.168.1.3;UID=sa;PWD=;Database=zcmrs Conn.open '============================ Read user data from table log========================= 'Define RecordSet object Set rs=Server.CreateObject(ADODB.Recordset) 'Set ConnectionString of Connection object Set rs.ActiveConnection=Conn 'Set cursor type rs.CursorType=3 'Open record set rs.Open Select username,password from erpuser Where username='&UserName&' '=================================================== If rs.EOF Then Errmsg=Tip: The user does not exist or the password is wrong Else If UserPwd<>rs.Fields(password) Then Errmsg=Tip: Login failed! Password error? Else 'Login successfully Errmsg= Session(Passed)=True Session(UserName)=rs.Fields(username) 'Identify user permissions Session(UserID)=rs.Fields(UserID) End If End If End If End If 'After login failing, the login form will be drawn If Not Session(Passed)=True Then %> <html> <head><title>Unt titled document</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:#FFFFF;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 system login</div> <form action=<%=request.ServerVariables(path_info)%> method=post name=MyForm id=MyForm> <p class=STYLE1>Username:<input name=UserName type=text id=UserName size=18 maxlength=20> </p> <p class=STYLE1> Password: <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=Login to system> <input name=rege type=button align=middle onClick=location='register.asp' id=rege value=register user> </p> </form> </div> </body> </html> <% '<p class=STYLE1> Verification code: <input name=CheckCode type=text id=CheckCo |
Share: Asp Regular Expression Learning We can easily verify the legality of various data by "regular expression" object. First, let's understand what exactly is the "regular expression" object of VBScript. Let's first look at a program:
2 pages in total Previous page 12 Next page