我有一个登录网页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"
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>