8.4 客户登录系统源代码
Login.htm
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>客户登录</title>
</head>
<body>
<Script Language="VBScript">
<!--
Sub Checkdata()
If Form1.Nick.Value = Empty Then
MsgBox "登录名没有输入!",48,"注意!"
ElseIf Form1.Password.Value = Empty Then
MsgBox "密码没有输入!",48,"注意!"
Else
Form1.Submit
End If
End Sub
-->
</Script>
<div align="center">
<table border="1" width="36%" height="159">
<tr>
<td width="100%" bgcolor="silver" height="36">
<p align="center"><b>
<font color="#000080" size="5" face="华文新魏">客户登录
</font></b></td>
</tr>
<tr>
<form name="Form1" method="POST" act
<td width="100%" height="111">
<table border="0" width="100%" height="106">
<tr>
<td width="39%" height="29">
<p align="right">登录名:</td>
<center>
<td width="61%" height="29">
<input type="text" name="Nick" size="15"></td>
</tr>
<tr>
<td width="39%" height="29">
<p align="right">密 码:</td>
<td width="61%" height="29">
<input type="password" name="Password" size="15"></td>
</tr>
<tr>
<td width="100%" colspan="2" height="36">
<p align="center">
<input type="button" value="登录" on
<input type="reset" value="重填">
<a href="Register.asp">注册</a></td>
</form>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
Checkuser.asp
<%@ Language=VBScript %>
<%
Dim Nick, Password
Nick=Request.Form("Nick")
Password=Request.Form("Password")
Set Conn = Server.CreateObject("ADODB.Connection")
P1="Provider=Microsoft.Jet.OLEDB.4.0;"
Path1="Da
Conn.Open P1&Path1
sql="Select Password,UserID From Users "&_
"Where Nick='"&Nick&"'"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open sql,Conn,0,1
If rs.BOF AND rs.EOF Then
Response.Write "<center>登录名不存在,"&_
"按<a href=JavaS
rs.Close
Set rs=Nothing
Set Conn=Nothing
Response.End
End if
If rs("Password")<>Password Then
Response.Write "<center>密码错误,"&_
"按<a href=javaS
rs.Close
Set rs=Nothing
Set Conn=Nothing
Response.End
End if
Session("Nick")=Nick
Session("UserID")=rs("UserID")
rs.Close
Set rs=Nothing
Set Conn=Nothing
Response.Redirect "Welcome.asp"
%>
Register.asp
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>新客户注册</title>
</head>
<body bgcolor="#CCFFFF">
<p align="center"><font color="#000080" face="华文新魏" size="6">
<b>新客户注册</b></font></p>
<form method="post" act
<div align="center">
<center>
<table border="1" width="66%" cellspacing="1" cellpadding="0">
<tr>
<td width="22%" align="right" height="30">昵称: </td>
<td width="78%"> <input name="Nick">**</td>
</tr>
<tr>
<td width="22%" align="right" height="30">密码: </td>
<td width="78%">
<input name="Password" size="20" type="password">**</td>
</tr>
<tr>
<td width="22%" align="right" height="30">密码确认: </td>
<td width="78%">
<input name="rePass" size="20" type="password">**</td>
</tr>
<tr>
<td width="22%" align="right" height="30">真实姓名: </td>
<td width="78%">
<input name="Name">**</td>
</tr>
<tr>
<td width="22%" align="right" height="30">电子邮件:</td>
<td width="78%">
<input name="Email" size="29">**</td>
</tr>
<tr>
<td width="22%" align="right" height="30">省份:</td>
<td width="78%">
<input name="Province"></td>
</tr>
<tr>
<td width="22%" align="right" height="30">城市:</td>
<td width="78%">
<input name="City"></td>
</tr>
<tr>
<td width="22%" align="right" height="30">详细地址:</td>
<td width="78%">
<input name="Address" size="47"></td>
</tr>
<tr>
<td width="22%" align="right" height="30">邮政编码:</td>
<td width="78%">
<input name="Zip" size="12" maxlength="8" ></td>
</tr>
<tr>
<td width="22%" align="right" height="30">联系电话:</td>
<td width="78%">
<input name="Phon" maxlength="16" >**</td>
</tr>
</table>
</center>
</div>
<p align="center">
<input type="submit" value="提交" name="B1">
<input type="reset" value="全部重写" name="B2"></p>
</form>
<p align="center">
<font size="3">(注:有<font color="#800080">**</font>
标记的项目必须填写!)</font></p>
</body>
</html>
Checkregi.asp
<%@ Language=VBScript %>
<%
Dim Nick, Name, Password, Email
Dim Province, City, Address, Zip, Phon
Nick=Trim(Request.Form("Nick"))
Name=Trim(Request.Form("Name"))
Password=Trim(Request.Form("Password"))
rePass=Trim(Request.Form("rePass"))
Email=Trim(Request.Form("Email"))
Province=Trim(Request.Form("Province"))
City=Trim(Request.Form("City"))
Address=Trim(Request.Form("Address"))
Zip=Trim(Request.Form("Zip"))
Phon=Trim(Request.Form("Phon"))
If Nick="" OR Name="" OR Password="" OR rePass=""_
OR Email="" OR Phon="" Then
ShowMessage "有必填项目没有填写!"
Set Conn=Nothing
Else
If Password<>rePass Then
ShowMessage "两次输入的密码不一样!"
Set Conn=Nothing
End If
Set Conn = Server.CreateObject("ADODB.Connection")
P1="Provider=Microsoft.Jet.OLEDB.4.0;"
Path1="Da
Conn.Open P1&Path1
Set rs = Server.CreateObject("ADODB.Recordset")
sql="Select * From Users Where Nick='"&Nick&"'"
rs.Open sql,Conn,0,1
If rs.EOF AND rs.BOF Then
sql="Insert Into Users(Nick,Password,Name,Email,"&_
"Province,City,Address,Zip,Phon)"&_
"Values('"&Nick&"','"&Password&"','"&Name&_
"','"&Email&"','"&Province&"','"&City&_
"','"&Address&"','"&Zip&"','"&Phon&"')"
Conn.Execute sql
rs.Close
Set rs=Nothing
Set Conn=Nothing
Response.Write "<center>祝贺你注册成功!"&_
"按<a href=Welcome.asp>这里</a>进入欢迎页面</center>"
Else
rs.Close
Set rs=Nothing
Set Conn=Nothing
ShowMessage "此登录名已被注册!"
End if
End if
%>
<!--显示返回重新填写信息的Sub过程:-->
<%Sub ShowMessage(msg)%>
<body bgcolor="#ccffff">
<center>
<h3><%=msg%></h3>
</center>
<form>
<p align="center">
<input type=Button Value="返回重新填写" On
</p>
</form>
</body>
<% Response.End %>
<% End Sub %>
评论