登陆
请看代码
<!--#include file="conn.asp"-->
<%
select case request("action")
case "login"
strusername=request.form("CustomerEmail")
strpassword=request.form("CustomerPassword")
if strusername="" then
response.write "<Script>window.alert('Miss Username!');history.go(-1);</Script>"
else
if strpassword="" then
response.write "<Script>window.alert('Miss Password!');history.go(-1);</Script>"
else
set conn = server.createobject("adodb.connection")
set strconn=server.createobject("adodb.recordset")
strSQL="select * from CustomerProfile where CustomerEmail='"&strusername&"'"
conn.open strDS1
strconn.open strSQL, conn
if strconn.eof then
response.write "<Script>window.alert('Wrong Username!');javascript:history.back(1);</Script>"
response.end
else
if strconn("CustomerPassword")<>strpassword then
response.write "<Script>window.alert('Wrong Password!');javascript:history.back(1);</Script>"
response.end
else
session("admin")=strconn("CustomerEmail")
session("passport") = strconn("CustomerSerial")
response.redirect "CP.asp"
end if
end if
end if
end if
strconn.close
set strconn=nothing
case "logout"
session("admin")=""
response.write "<Script>window.alert('Goodbye!!!');location.replace('index.asp');</Script>"
end select
%>
<html>
<head>
<title>Login</title>
</head>
<body leftmargin=0 topmargin=100 >
<div align="center">
<table border="0" width="400" cellspacing="0" cellpadding="0" id="table1" >
<tr>
<td>
<p style="line-height: 200%" align="center"><font color="#000000">
<b>LogIn</b></font></td>
</tr>
</table>
</div>
<div align="center">
<form name=form method="post" action="LogIn.asp?action=login" >
<table border="0" width="400" cellspacing="0" cellpadding="0" id="table1" bgcolor="#FFFFFF">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="30%" align="right" class="login"><br>
<p style="line-height: 200%"><b>Username:</b></td>
<td width="70%"><br>
<p style="line-height: 200%; margin-left:20px">
<input type=text name=CustomerEmail size=20 class="input"></td>
</tr>
<tr>
<td width="30%" align="right" class="login"><br>
<p style="line-height: 200%"><b>Password:</b></td>
<td width="70%"><br>
<p style="line-height: 200%; margin-left:20px">
<input type=password name=CustomerPassword size=20 class="input"></td>
</tr>
<tr>
<td colspan="2"><br>
<p align="center" style="line-height: 200%">
<input value="Log In" name="LogIn" type="submit" class="submit"></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table></form>
</div>
</body>
</html>
这个能正常登陆,我想实现的是,当出现错误信息的时候不是出现对话框,而是在LOGIN下面出现相关的错误信息文字,请问该怎么做?谢谢