Asp single-page Query Database!

Source: Internet
Author: User
 
<! -- # 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 your username! '); History. go (-1); </script> ")
Response. End ()
Else
X_name = Request. Form ("user_name ")
End If
'Indicates whether the username for the rebellion is empty!
If Request. Form ("user_pwd") = "" Then
Response. Write ("<script Language = 'javascript '> alert ('sorry, please enter your password! '); History. go (-1); </script> ")
Response. End ()
Else
X_pwd = Request. Form ("user_pwd ")
End If
'Disallow the user password to be 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, the user or password is incorrect! '); History. go (-1); </script> ")
Response. End ()
End If
Else
%>
<Title> -- & gt; system logon </title>
<Style type = "text/css">
<! --
. Zi {
Font-family: Arial, Helvetica, sans-serif;
Font-size: 10pt;
}
-->
</Style>
<P> & nbsp; </p>
<P> & nbsp; </p>
<P> & nbsp; </p>
<P> & nbsp; </p>

<Table width = "320" height = "140" border = "0" align = "center" cellpadding = "0" cellspacing = "1" bgcolor = "#33 CCFF" class = "zi">
<Tr>
<Td colspan = "2"> -- & gt; system logon </td>
</Tr>
<Form name = "form1" method = "post" action = "index. asp">
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.