首页有显示注册和登录的头文件<!--#include file="top.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>
<div align="center">
<center>
<table border="1" width="800" height="22">
<tr>
<td height="93" width="174" rowspan="2"><a href="http://www.netsfamily.com/ad/logo.gif" target="_blank"><img height="72" alt="网络家园论坛
网络家园论坛" src="LOGO.gif" width="172" border="0"></a></td>
<td height="45" width="610"><a href="index.asp">回首页</a></td>
</tr>
<tr>
<td height="48" width="610">
<%if session("username")<>""then
response.write(Session("username"))
response.write(",您好!欢迎你的到来到")
response.write("<a href='quit.asp'>")
response.write("<font size='2'>")
response.write("安全退出")
response.write("</font>")
response.write("</a>")
else
%>
<form action="login.asp" method="post">
用户名:<input type="text" name="username" size="20">密码:<input type="password" name="pwd" size="20"><input type="submit" value="登录" name="B1">
<a href="userregister.asp">注册</a></form></td>
</tr><%end if%>
</table>
</center>
</div>
然后注册页面的代码是:
<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>New Page 1</title>
<script language="JavaScript">
function checkform()
{
if(register.username.value=="")
{
alert("请您输用户名!")
document.register.username.focus();
return false
}
if(register.password.value=="")
{
alert("请您输密码!")
document.register.password.focus();
return false
}
if((register.password.value.length<6)||(register.password.value.length>16))
{
alert("密码必须在6到16位之间!")
document.register.password.focus();
return false
}
if(register.password.value != register.repwd.value)
{
alert("前后两次输入的密码必须一致!");
document.register.repwd.focus();
return false;
}
}
</script>
</head>
<body>
<form name="register" method="POST" action="register.asp" onSubmit="return checkform();">
<div align="center">
<center>
<table border="1" width="800" height="257">
<tr>
<td height="46">
填写注册表单</td>
</tr>
<tr>
<td height="47">用户名:<input type="text" name="username" size="20">
</td>
</tr>
<tr>
<td height="63">密码:<input type="password" name="password" size="20"></td>
</tr>
<tr>
<td height="77"> 再次输入密码:<input type="password" name="repwd" size="20"></td>
</tr>
</table>
</center>
</div>
<p align="center"><input type="submit" value="填好了,注册!" name="B1">
<input type="reset" value="全部重写" name="B2"></p>
</form>
</body>
</html>
注册成功显示的页面代码是:
<% @Language="VBScript" %>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("mydb.mdb")
%>
<html>
<head>
<title>新用户注册</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
</head>
<body>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<%
set objRS=Server.CreateObject("ADODB.Recordset")
sql="select username from [user] where username = '"&Request("username")&"'"
objRS.open sql,conn,1,3
if not objRS.eof then
%>
</p>
<p align="center"> 对不起,您所注册的用户已经存在!请换个用户名。
<%
Response.Write("<a href=""javascript:history.go(-1);"">[返回重填]</a>")
response.end()
else
dim rs
set rs=Server.CreateObject("ADODB.Recordset")
rs.open "select * from [user]",conn,1,3
rs.AddNew
rs("username")=trim(Request("username"))
rs("pwd")=trim(Request("password"))
rs("userrank")=1
rs("registertime")=Now()
rs.update
rs.close
Response.Write("恭喜你注册成功!欢迎加入[网络家园]!<br>")
Response.Write("<a href=""index.asp"">[返回首页]</a>")
end if
objRS.close
conn.close
set objRS=nothing
set conn=nothing
%>
</p>
</body>
</html>
现在问题是:我注册成功之后返回首页,不是出现:“XXX,您好,欢迎您的到来!”
而还是出现要求需要填写“用户名:和密码:”这是怎么回事呢?
我查看了一下数据库,也填加成功了啊!请大家帮忙指教啊!