User logon verification script, chkpwd.asp
<%
' ======= user logon verification script =======
' If the passed object has not been defined, it is defined as false, indicating that the validation is not passed
If IsEmpty (Session ("passed")) Then
Session ("passed") =false
End If
' Session (' passed ') =false, indicating that validation has not yet been validated, starts reading the authentication information from the form
If session ("passed") =false Then
Username=request.form ("UserName")
Userpwd=request.form ("Userpwd")
If username= "" Then
errmsg= "prompt: Please enter user name and password"
Else
' =================== Connection Database =====================
Set conn= Server.CreateObject ("ADODB.") Connection ")
Conn.connectionstring= "Driver={sql Server}; server=192.168.1.3; Uid=sa; pwd=;D Atabase=zcmrs "
Conn.Open
' =================== reads the user data from the table log =====================
' Define a Recordset object
Set rs=server.createobject ("ADODB. Recordset ")
' Set the connectionstring of the Connection object
Set Rs. Activeconnection=conn
' Set Cursor type
Rs. Cursortype=3
' Open recordset
Rs. Open "Select Username,password from Erpuser Where username= '" &UserName& ""
' =================== authentication ======================
If Rs. EOF Then
errmsg= "prompt: User does not exist or password is wrong"
Else
If Userpwd<>rs. Fields ("password") Then
errmsg= "Hint: Login failed! "
Else ' Login Successful
Errmsg= ""
Session ("passed") =true
Session ("UserName") =rs. Fields ("username")
' Identify user rights session (' UserID ') =rs. Fields ("UserID")
End If
End If
End If
End If
' Login unsuccessful, then draw the login form
If not session ("passed") =true Then
%>
<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>
<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 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= "a" maxlength= ">"
</p>
<p class= "STYLE1" > Password: <input name= "userpwd" type= "password" id= "Userpwd" size= "a" maxlength= ">"
</p>
<p align= "center" class= "STYLE2" ><%=Errmsg%> </p>
<p>
<input type= "Submit" align= "Middle" name= "submit" value= "Login System" >
<input name= "Rege" type= "button" align= "Middle" onclick= "location=" "Register.asp" id= Rege "" (Registered users) >
</p>
</form>
</div>
</body>
<%
' <p class= ' STYLE1 > Verification Code: <input name= "Checkcode" type= "text" id= "Checkcode" size= "6" maxlength= "4" >
"</p>
Response. End
End If
%> webjx.com
The page to be accessed erp.asp
<!--#include file= "chkpwd.asp"-->
<body>
<div style= ' font-size:12px;font-weight:bold;border:1px solid #001;p adding:4px;background: #FFCCFF; margin-top:0; ' > Welcome to use the ERP query system, the current logged-in user is:
<%
If session ("passed") =true Then
Response.Write (Session ("UserName"))
End If
%><a href= "logout.asp" > Exit system </a>
</div>
</body> webjx.com
Each time you open erp.asp, the chkpwd.asp () is executed first, which effectively prevents unauthorized users from accessing the specified Web page.
logout.asp System exit
<body>
<%
Session ("passed") =false
Session ("UserName") = ""
Response.Redirect ("index.asp")
%>
</body>
Webjx.com
Submit a form with a picture
<form name= "Form1" method= "Post" action= "" >
<TD align= "right" ><input type= "image" method= "submit" name= "Submit" src= "Image/loginin.gif" width= "70" height= "alt=" "Submit" ></td>
</form>
Tage: Login Verification QQ Login Verification PHP Login Verification QQ Login Verification Code login QQ Input Verification Code JSP login Verification QQ Login Authentication User Login Verification Verification Code login asp.net login Authentication code function