User login verification script, chkpwd.asp
<%
'======== User login verification script =======
'If the passed object is not defined, it defines it as false, indicating that it has not passed the verification
If Isempty (Session (PASSED)) then
Session (passed) = false
End if
'SESSION (PASSED) = FALSE, indicating that the verification information from the form has not been passed, it has not passed the verification
If session (passed) = false then
Username = request.form (username)
Userpwd = request.Form (userpwd)
If username = then
Errmsg = prompt: Please enter the user name and password
Else
'=================== connect database ==================
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 ====================
'Define the RECORDSET object
Set rs = server.createObject (Adodb.oldSet)
'Set Connection object ConnectionString
Set RS.ActiveConnection = CONN
'Set the cursor type
rs.cursortype = 3
'Open the record set
RS.Oopen Select username, password from erpuseer where username = '& username &'
'=========================================
If rs.eof then
ErRMSG = Tip: Users do not exist or password errors
Else
If userpwd <> RS.Fields (Password) then
ErRMSG = Tip: Log in! The password is wrong?
Else 'Login successful
Errmsg =
Session (passed) = true
Session (username) = rs.fields (username)
'Identify the user permissions session (userid) = rs.fields (userid)
End if
End if
End if
End if
'After the login is unsuccessful, the login form is drawn
If not session (passed) = true then
%>
<html>
<head> <Title> Non -title document </Title>
<Style Type = Text/CSS>
<!--
.Style1 {font-size: 12px; font-weight: bold; margin-heft: 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 CKGROUND- 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 = mide name = submit value = login system>
<input name = Rege type = Button Align = Middle Onck = LOCATION = 'Register.asp' ID = Rege Value = Registered User>
</p>
</form>
</div>
</body>
</html>
<%
'<p class = style1> Verification code: <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
%>
Page Erp.asp to be visited
<!-#Include file = chkpwd.asp->
<body>
<div style = 'font-size: 12px; font-weight: bold; border: 1px solid User for:
<%
If session (passed) = true then
Response.write (session (username))
End if
%> <A href = logout.asp> Exit system </a>
</div>
</body>
Each time you open ERP.ASP, you first execute chkpwd.asp (), which can effectively prevent unauthorized users from accessing specified web pages.
Logout.asp system exit
<body>
<%
Session (passed) = false
Session (username) =
Response.redirect (index.asp)
%>
</body>
Use the picture to submit the form
<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>