<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆</title>
<script language="javascript">
<!--
function validateLogin()
{
if (document.frmlogin.txtUserName.value==""){
alert("请输入用户名")
document.frmlogin.txtUserName.focus()
return false
}
if (document.frmlogin.txtPassword.value==""){
alert("请输入密码")
document.frmlogin.txtPassword.focus()
return false
}
if (document.frmlogin.txtUserName.value.indexOf("'") !=-1){
alert("用户名中不能包含撇号!")
document.frmlogin.txtUserName.focus()
return false
}
if (document.frmlogin.txtPassword.value.indexOf("'") !=-1){
alert("密码中不能包含撇号!")
document.frmlogin.txtPassword.focus()
return false
}
}
-->
</script>
</head>
<style type="text/css">
<!--
.style2 {
font-size: 18px;
color: #006666;
}
.style3 {color: #006666}
-->
</style>
<body>
<form name="frmlogin" method="post" action="verifyID.asp" onSubmit="return validateLogin()">
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#006666">
<tr>
<th align="center" valign="middle" bgcolor="#FFFFFF" scope="col"><p> </p>
<p><span class="style2">登陆界面</span> </p>
<p><span class="style3">用户名:</span>
<input name="txtUserName" type="text" id="txtUserName" size="20" maxlength="20" value="">
</p>
<p><span class="style3">密 码:</span>
<input name="txtPassword" type="password" id="txtPassword" size="20" maxlength="20" value="">
</p>
<p>
<input type="submit" name="xsubmit" value="提交">
<input name="xreset" type="reset" value="重置">
</p>
<p> </p></th>
</tr>
</table>
</form>
</body>
</html>
verifyID.asp 的代码
<!--#include file="GeneralTool.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆</title>
</head>
<body>
<div align=center>
<%
dim strUserName
dim strPassword
strUserName=request.form("txtUserName")
strPassword=request.form("txtPassword")
call tackleEmpty(strUserName)
call tackleEmpty(strPasswrod)
call tacklePrime(strUserName)
call tacklePrime(strPassword)
call tackleOverLen(strUserName,15)
call tackleOverLen(strPassword,15)
call openDB()
sql="select * form UserInfo where (USER_NAME='"&strUserName&"' "&" and Password='"&Password&"')"
set rs=conn.Execute(sql)
if not rs.eof then
session("UserName")=strUserName
call showMsg("登陆成功!")
else
call showMsge("你还没有注册呢!请点击下面开始注册:)")
end if
call closeDB()
%>
</div>
</body>
</html>
GeneralTool.asp的代码
<%
dim sql,conn,rs,webURL
webURL="http://"&Request.ServerVariables("SERVER_NAME")&"/"
'简单的出错处理(任何暴露给客户得错误信息都是不可以原谅得!)
on error resume next
'打开数据库连接
sub openDB()
set conn=Server.CreateObject("ADODB.Connection")
conn.open"PROVIDER=SQLOLEDB; " & " DATASOURCE=TOMMAO; " & " DATABASE=mydata; " & " UID=sa;PWD=123"
set rs=Server.CreateObject("ADODB.Recordset")
end sub
'关闭数据库
sub closeDB()
if ISObject(conn) then
rs.close
set rs = nothing
conn.close
set conn = nothing
end if
end sub
'处理空字符窜
sub tackleEmpty(strItem)
strItem = trim(strItem)
if strItem = "" then
call closeDB()
response.redirect webURL
end if
end sub
'处理撇号
sub tacklePrime(strItem)
if instr(strItem,"'")<>0 then
call closeDB()
response.redirect webURL
end if
end sub
'处理长度问题
sub tackleOverLen(strItem,intLen)
if len(strItem)>intlen then
call closeDB()
response.redirect webURL
end if
end sub
'显示信息
sub showMsg(strItem)
response.Write("<font size=5 color=geen>strItem</font>")
end sub
sub showMsge(strItem)
response.Write("<br><font size=5 color=green>strItem</font><br><br><a href=xxxx.ASP><font size=5 color=green>注册</font></a>")
end sub
%>
我现在的问题是用LOGIN.ASP提交登陆信息时,提交不了,各位高手帮我看看。