Thread: Error messages
View Single Post
  #8 (permalink)  
Old June 5th, 2005, 12:11 PM
ldoodle ldoodle is offline
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

And this is the code for my userEnv.asp file:

Code:
<%
    Dim objConn, rsEA, strSQL, strHostSvr, strHttpRef, strUserName, strNewStyle, strUserStyle, strUserData, strUserInfo, strBaseDir

    strHostSvr = Request.ServerVariables("HTTP_HOST")
    strHttpRef = Request.ServerVariables("HTTP_REFERER")
    strUserName = Request.ServerVariables("LOGON_USER")

    Set objConn = Server.CreateObject("ADODB.Connection")
        objConn.Open "DBQ=" & Server.MapPath("/database/ea.mdb") & ";DRIVER={Microsoft Access Driver (*.mdb)};"

    Set rsEA = Server.CreateObject("ADODB.Recordset")

    strSQL = "SELECT tblStyleSheet.UserName, tblStyleSheet.UserStyle FROM tblStyleSheet;"

        rsEA.CursorType = 2
        rsEA.LockType = 3
        rsEA.Open strSQL, objConn

*************************
    strNewStyle = Request.QueryString("UserStyle")
        If Len(strNewStyle) > 1 Then
            objConn.Execute "UPDATE [tblStyleSheet]" & " SET [UserStyle] = '" & strNewStyle & "'" & " WHERE [UserName] = '" & strUserName & "';"
        End If
*************************

    set strUserData = Server.CreateObject("ADSystemInfo")
    set strUserInfo = getObject ("LDAP://" & strUserData.Username)
        For Each Group in strUserInfo.Groups
            If Group.cn = "AYL Administrators" Then
                strBaseDir = "staff/administrators"
            End If
            If Group.cn = "AYL Support Staff" Then
                strBaseDir = "staff/support"
            End If
            If Group.cn = "AYL Teachers" Then
                strBaseDir = "staff/teachers"
            End If
        Next
%>
Again, the code inside the *'s is the updating code, which works ok as far as I can tell.

The only thing I need is to 'extract' the users stylesheet entry from the DB and set it as a variable to use on the pages.


Thanks/...

Reply With Quote