ASP implement single page query database

Source: Internet
Author: User
Tags empty end implement query
Data | database

<!--#include file= ". /conn.asp "-->
<%
Dim Rs,sql,x_name,x_pwd,x_count
If Request.Form ("do") = "OK" Then
If Request.Form ("user_name") = "" Then
Response.Write ("<script language= ' JavaScript" >alert (' Sorry, please enter username!\t '); History.go ( -1);</script> ")
Response.End ()
Else
X_name = Request.Form ("user_name")
End If
' ↑ The Renegade username is empty!
If Request.Form ("user_pwd") = "" Then
Response.Write ("<script language= ' JavaScript" >alert (' Sorry, please enter user password!\t '); History.go ( -1);</script> ")
Response.End ()
Else
X_pwd = Request.Form ("User_pwd")
End If
' ↑ Renegade User password is empty!
Set rs = Server.CreateObject ("Adodb.recordset")
Sql= "SELECT * from [user] where user_name= '" &x_name& "' and user_pwd= '" &x_pwd& "'"
Rs.Open sql,conn,1,1
If not Rs. Eof Then
Session ("S_name") =rs ("user_name")
Session ("S_shen") =rs ("Shenfen")
Session ("S_shi") =rs ("Shijian")
Response.Redirect "Infoin.asp"
Else
Response.Write ("<script language= ' JavaScript" >alert (' Sorry, user or password error!\t '); History.go ( -1);</script> ")
Response.End ()
End If

Else
%>

<title>--> System Login </title>
<style type= "Text/css" >
<!--
. Zi {
Font-family:arial, Helvetica, Sans-serif;
font-size:10pt;
}
-->
</style>
<p> </p>
<p> </p>
<p> </p>
<p> </p>

<table width= "height=" 140 border= "0" align= "center" cellpadding= "0" cellspacing= "1" bgcolor= "#33CCFF" class= " Zi ">
<tr>
&LT;TD colspan= "2" >--> system login </td>
</tr>
<form name= "Form1" method= "Post" action= "index.asp" >
<tr bgcolor= "#FFFFFF" >
&LT;TD width= "><div" align= "Center" > Account number:</div></td>
&LT;TD width= "239" >
<input name= "user_name" type= "text" id= "user_name" >
</td>
</tr>
<tr bgcolor= "#FFFFFF" >
<td><div align= "center" > Password:</div></td>
<td><input name= "user_pwd" type= "password" id= "User_pwd" ></td>
</tr>
<tr bgcolor= "#FFFFFF" >
<td> </td>
<td><input type= "Submit" name= "submit" value= "Login" >
<input type= "button" Name= "Submit" value= "Close" >
<input name= "Do" type= "hidden" id= "Do" value= "OK" ></td>
</tr>
</form>
<tr>
&LT;TD colspan= "2" ><div align= "right" >v1.00</div></td>
</tr>
</table>
<%end if%>



Related Article

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.