Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Problems creating sessions.. help help!!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problems creating sessions.. help help!!

 Post Reply Post Reply
Author
l_baltodano View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 09 June 2003
Location: Nicaragua
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote l_baltodano Quote  Post ReplyReply Direct Link To This Post Topic: Problems creating sessions.. help help!!
    Posted: 24 October 2003 at 1:19pm

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
%>         & 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!

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.