| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 598 人关注过本帖
标题:各位帮我看看
只看楼主 加入收藏
zbt886
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2005-10-26
收藏
 问题点数:0 回复次数:4 
各位帮我看看
LOGIN.ASP 的代码
<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>&nbsp;</p>
<p><span class="style2">登陆界面</span>&nbsp;&nbsp;</p>
<p><span class="style3">用户名:</span>
<input name="txtUserName" type="text" id="txtUserName" size="20" maxlength="20" value="">
</p>
<p><span class="style3">密&nbsp;&nbsp;码:</span>
<input name="txtPassword" type="password" id="txtPassword" size="20" maxlength="20" value="">
</p>
<p>
<input type="submit" name="xsubmit" value="提交">
&nbsp;&nbsp;
<input name="xreset" type="reset" value="重置">
</p>
<p>&nbsp;</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提交登陆信息时,提交不了,各位高手帮我看看。

谢谢
搜索更多相关主题的帖子: html javascript function content 用户名 
2005-11-11 23:30
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
收藏
得分:0 
提交不了???是点击后没反应吗?如果是
<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;
}
return true;
}
-->
</script>


2005-11-12 08:35
zbt886
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2005-10-26
收藏
得分:0 

是提交不了,不过按你说的做也提交不了。
我觉得我的问题不是出在LOGIN.asp。因为我用另外一种方法做是成功的了
login.asp提交是正常的。帮我看看后面的看有问题没。

2005-11-12 10:18
zbt886
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2005-10-26
收藏
得分:0 

没人愿意帮我试下吗?

2005-11-12 11:07
zbt886
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2005-10-26
收藏
得分:0 
斑竹跑哪里去了等你们消息呢
2005-11-12 18:59
快速回复:各位帮我看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011876 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved