Print Page | Close Window

Is there a chance to solve this problem?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=6739
Printed Date: 31 March 2026 at 11:59am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Is there a chance to solve this problem?
Posted By: l_baltodano
Subject: Is there a chance to solve this problem?
Date Posted: 26 October 2003 at 6:56pm

Hi again everydoby.. this time i have this issue.. (A simple one I hope) but as I always say.. it´s better to ask than stay with the question mark .

This time i´m trying to authenticate my users and open a session instead of using cookies.

in my validation form (Inside my login.asp) it goes like this:

<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUsername=CStr(Request.Form("Username"))
If MM_valUsername <> "" Then
  MM_fldUserAuthorization=""
  MM_redirectLoginSuccess="myAds.asp"
  MM_redirectLoginFailed="register.asp"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_connDUclassified_STRING
  MM_rsUser.Source = "SELECT U_ID, U_PASSWORD, ACCESS"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM USERS WHERE U_ID='" & MM_valUsername &"' AND U_PASSWORD='" & CStr(Request.Form("Password")) & "'"
  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
'This is the section i´m not sure is right!.. because i don´t know how to add this information to the session 
    Session("UserLevel") = MM_rsUser("ACCESS")
    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
%>

then i have this another sentence in another webpage where i try to print different values for each user access level (There are 2 levels admin and user)

<%
if Session("UserLevel") = admin then
%>         & amp; nbsp;     
                
                 <tr valign="middle">
                   <td nowrap align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#009999">Imagen:</font></b></td>
                   <td>
                     <input type="file" name="AD_IMAGE" size="35">
                   </td>
                 </tr>
                 <tr valign="middle">
                   <td nowrap align="right" valign="top"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#009999">Descripción:</font></b></t d>
                   <td>
                     <textarea name="AD_DESCRIPTION" cols="60" rows="5"></textarea>
                   </td>
                 </tr>
                
<%
Else
%>
                 <tr valign="middle">
                   <td nowrap align="right" valign="top"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#009999">Descripción:</font></b></t d>
                   <td>
                     <textarea name="AD_DESCRIPTION" cols="60" rows="5"></textarea>
                   </td>
                 </tr>
<%
End If
%>

I don´t really know what i´m doing wrong, because when the webpage appears into my brower it just displays one value (the 2nd) AND I´M LOGIN WITH THE ADMINISTRATOR ACCOUNT

Then i login with a user account and it gives me the same value ..wich is right but i know that there´s something wrong with the script.. plz.. could anybody help me!




Replies:
Posted By: ctscott
Date Posted: 27 October 2003 at 9:45am

should the line

if Session("UserLevel") = admin then

have quotes around admin? it almost implies to me that you may have a variable by that name.

i have at times modified my code to display the values of variables when i have problems such as this as they don't contain the values i thing they should.  also empty and null whip my butt at times.

not much help but thought i'd give it a go.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net