Logon displaying Name instead of User ID

L

Lee Steele

I have a password protected website. The site is a combination of FP and
EW. When a person logs in, the code shown below displays either "You are
not logged on" on the users id "UID" if they are logged in. I am trying to
have the users full name displayed instead of the UID. There are three
fields in the password database, UID, PWD and FullName.

<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on.</b>"
Else
Response.Write "<b>" & Session("UID") & "</b>"
End If
%>


This is the code used on the logon page to verify UID and PWD and to save
the UID in a Session.

<%
' Was this page posted to?
If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then
' If so, check the username/password that was entered.
If ComparePassword(Request("UID"),Request("PWD")) Then
' If comparison was good, store the user name...
Session("UID") = Request("UID")
' ...and redirect back to the original page.
Response.Redirect Session("REFERRER")
End If
End If
%>



This is the code on each page that is password protected.

<% @language="vbscript" %>
<!--#include virtual="/_private/logon.inc"-->


This is the code I modified in an attempt to display the FullName instead of
the UID.

<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on.</b>"
Else
Response.Write "<b>" & Session("FullName") & "</b>"
End If
%>


This is the modified code I used in an attempt to pull and store the
FullName along with the UID in a session.

<%
' Was this page posted to?
If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then
' If so, check the username/password that was entered.
If ComparePassword(Request("UID"),Request("PWD")) Then
' If comparison was good, store the user name...
Session("UID") = Request("UID")
Session("FullName") = Request("FullName")
' ...and redirect back to the original page.
Response.Redirect Session("REFERRER")
End If
End If
%>

The original code works perfectly. The modified code however, does log a
person in, but does not display the FullName. It does display "You are not
logged on " on the logon page.

Any advise on how to correct this problem would be greatly appreciated.

Thanks
Lee Steele
 
R

Ronx

Making the assumption that your code is derived from
http://support.microsoft.com/default.aspx?scid=kb;en-us;825498

In Function ComparePassword(UID,PWD)

change:

' Set the status to true/false for the database lookup.
ComparePassword = Not(objRS.EOF)
' Close your database objects.


to

' Set the status to true/false for the database lookup.
ComparePassword = Not(objRS.EOF)
if ComparePassword Then
session("username") = objRS("FullName")
end if
' Close your database objects.



Then

<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on.</b>"
Else
Response.Write "<b>" & Session("UID") & "</b>"
End If
%>

can be changed to

<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on.</b>"
Else
Response.Write "<b>" & Session("username") & "</b>"
End If
%>

--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.
 
L

Lee Steele

Ron,
Thanks for your input. Your assumption was correct. I should have stated
where the code was derived from, my apologies. The changes you suggested
work perfectly.

Thanks again.

Lee Steele

Making the assumption that your code is derived from
http://support.microsoft.com/default.aspx?scid=kb;en-us;825498

In Function ComparePassword(UID,PWD)

change:

' Set the status to true/false for the database lookup.
ComparePassword = Not(objRS.EOF)
' Close your database objects.


to

' Set the status to true/false for the database lookup.
ComparePassword = Not(objRS.EOF)
if ComparePassword Then
session("username") = objRS("FullName")
end if
' Close your database objects.



Then

<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on.</b>"
Else
Response.Write "<b>" & Session("UID") & "</b>"
End If
%>

can be changed to

<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on.</b>"
Else
Response.Write "<b>" & Session("username") & "</b>"
End If
%>

--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp

Reply only to group - emails will be deleted unread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top