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