首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > vbScript >

为什么小弟我显示不了显示用户登陆

2012-02-16 
为什么我显示不了显示用户登陆?我有一个登录网页login.asp,显示用户名和密码 ,输入正确后登录成功后到inde

为什么我显示不了显示用户登陆?
我有一个登录网页login.asp,显示用户名和密码 ,输入正确后登录成功后到index.asp, 现在我想在登录成功后在index.asp
显示登录网页所输入的用户名,就想很多网页一样:欢迎XX登录!. 网上找了很多方法,也很多热心人帮助,但是都不详细啊,我都没有成功, 下面附我的login.asp 的代码, 请详细指点一下在什么地方实现这个功能吧?谢谢大家。完成结分。

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/hhd.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_hhd_STRING
Recordset1.Source = "SELECT * FROM dbo.userid"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("bmid"))
If MM_valUsername <> "" Then
  MM_fldUserAuthorization=""
  MM_redirectLoginSuccess="new.asp"
  MM_redirectLoginFailed="wro.html"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_hhd_STRING
  MM_rsUser.Source = "SELECT bmid, password"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.userid WHERE bmid='" & Replace(MM_valUsername,"'","''") &"' AND password='" & Replace(Request.Form("passworda"),"'","''") & "'"
  MM_rsUser.CursorType = 0
  MM_rsUser.CursorLocation = 2
  MM_rsUser.LockType = 3
  MM_rsUser.Open
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then 
  ' username and password match - this is a valid user
  Session("MM_Username") = MM_valUsername
  If (MM_fldUserAuthorization <> "") Then
  Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
  Else
  Session("MM_UserAuthorization") = ""
  End If
  if CStr(Request.QueryString("accessdenied")) <> "" And false Then
  MM_redirectLoginSuccess = Request.QueryString("accessdenied")
  End If
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginSuccess)
  End If
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginFailed)
End If
%>
<html>
<head>
<title>管理登陆</title>
<link href="style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!-- Fireworks MX Dreamweaver MX target. Created Tue Sep 03 22:44:42 GMT+0800 (¥x¥_?D·CRE?!) 2002-->
</head>
<body bgcolor="#ffffff">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td align="center" valign="middle"><form ACTION="<%=MM_LoginAction%>" name="form1" method="POST">
  <table width="40%" border="1" cellspacing="0" cellpadding="5" bordercolordark="#CCCCCC" bordercolorlight="#000000">
  <tr>
  <td height="38" bgcolor="#f2d94a"><div align="right">用户帐号:</div></td>


  <td bgcolor="#f2d94a"><div align="left">
  <INPUT name=ida id="ida" 
  style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 9pt" size=15 maxLength=16>
  </div></td>
  </tr>
  <tr>
  <td height="27" bgcolor="#f2d94a"><div align="right">用户密码:</div></td>
  <td bgcolor="#f2d94a"><div align="left">
  <INPUT name=passworda type="password" id="passworda" 
  style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 9pt" size=15 maxLength=16>
  </div></td>
  </tr>
  <tr>
  <td bgcolor="#f2d94a"><div align="right">
  <label>
  <select name="bmid" size="1" id="bmid">
  <option value="0005">黄岐</option>
  <option value="0006">华远</option>
  <option value="0007">中心</option>
  </select>
  </label>
<br>
  </div></td>
  <td bgcolor="#f2d94a"><div align="left"><a href="javascript:form1.submit();"><img src="images/login.gif" width="34" height="18" border="0"></a></div></td>
  </tr>
  </table>
  </form></td>
  </tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>



[解决办法]
jf,恭喜楼主
[解决办法]
既解决了,就接分了

热点排行