ASP User Login Code

Source: Internet
Author: User

Asp+access User Login code, AN.MDB database name
FD Table Name
Y_username user name segment, y_password password field.
Loginnew.asp Web page
<%
Dim Username,password

Username=request.form ("username")
Password=request.form ("password")
Set Rs=server.createobject ("Adodb.recordset")
conn = "dbq=" + Server.MapPath ("Huiyuan.mdb") + ";D efaultdir=;
Driver={microsoft Access DRIVER (*.mdb)};
Sql= "SELECT * from pUser213 where y_username= '" &username& ""
Rs.Open sql,conn,1,1
If Rs.eof Then
Response.Write "<script>alert (' Login failed '); History.back ();</script>"
Response.End
Else
If RS ("Y_password") <>password Then
Response.Write "<script>alert (' Login failed '); History.back ();</script>"
Response.End
End If
Session ("admin") =username
Response.Write "<script>alert" (' Login Success '); location.href= ' index.asp ' </script> '
End If
%>
Look at the HTML code again.
Login.htm page

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Login </title>

<body>
<p> </p>
<form name= "Form1" method= "Post" action= "loginnew.asp" >
<table width= "border=" 1 "align=" center "cellpadding=" 0 "cellspacing=" 0 ">
<tr>
&LT;TD colspan= "2" ><div align= "center" > Login </div></td>
</tr>
<tr>
&LT;TD width= "><div" align= "center" > Username </div></td>
&LT;TD width= "137" valign= "Top" ><input "name=" username "text"
Id= "username" size= "></td>"
</tr>
<tr>
<td><div align= "center" > Password </div></td>
&LT;TD valign= "Top" ><input name= "password" type= "password"
id= "Password" size= "></td>"
</tr>
<tr>
&LT;TD colspan= "2" ><div align= "center" >
<input type= "Submit" name= "Submission" value= "submitted" >
</div></td>
</tr>
</table>
</form>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.