Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Session Management

    Hello,

    We've reviewing the CGI::Session and Apache::Session modules, and both seem to do pretty much the same thing. Is one better then the other, better advantages one over the other, more portable,..etc.

    Any feedback would be appreciated :)

    Mike<mickalo>Blezien
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Thunder Rain Internet Publishing
    Providing Internet Solutions that work!
    [url]http://www.thunder-rain.com[/url]
    MSN: [email]mickalo@thunder-rain.com[/email]
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    Mike Blezien Guest

  2. Similar Questions and Discussions

    1. CF/Flex3 and session management
      Does anyone know how to manage user access to CF components so that a person must be authenticated before running the CFComponent? Otherwise, if I...
    2. Session management in MX
      We are going to move 2 applications from 2 separate 4.5 servers to 1 MX server and both applications use pretty much the same code for session...
    3. session management logout
      I am trying to get some help with the cfheader expires, pragma and cache - control. As I understand, the meaning of these tags is to keep users...
    4. Session Management of Non-CFM files
      I have a directory which contains cfm and NON-cfm files. The user has to login before accessing the site. I am using session variables to track...
    5. Session State Management
      Dear Friends, I'm working on a web besed project. In visual studio I have a solution and multiple web projects in this solution. How can I use...
  3. #2

    Default Session Management

    Hello,

    We are in the process of setting up a session management
    system for a complex membership system project. I've been
    reading through the docs on CGI::Session and Apache::Session
    and was hoping to get some feedback if one is preferred
    over another, the pros and cons of using one over
    another,... portability advantages,...etc. So anyone that's
    use both of these modules, any recommendations would be much
    appreciated.

    Thx's

    --
    Mike<mickalo>Blezien
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Thunder Rain Internet Publishing
    Providing Internet Solutions that work!
    [url]http://www.thunder-rain.com[/url]
    Quality Web Hosting
    [url]http://www.justlightening.net[/url]
    MSN: [email]mickalo@thunder-rain.com[/email]
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    Mike Blezien Guest

  4. #3

    Default Re: Session Management

    On Fri, 2003-12-12 at 15:50, Mike Blezien wrote:
    > Hello,
    >
    > We are in the process of setting up a session management
    > system for a complex membership system project. I've been
    > reading through the docs on CGI::Session and Apache::Session
    > and was hoping to get some feedback if one is preferred
    > over another, the pros and cons of using one over
    > another,... portability advantages,...etc. So anyone that's
    > use both of these modules, any recommendations would be much
    > appreciated.
    Mike,

    I recommend using HTML::Mason and the MasonX::Request::WithApacheSession
    module which does all the work for you. It is basically a Mason
    interface to Apache::Session.

    I am working on a HOWTO for setting up a basic session with it, as the
    POD isn't easy to follow.

    HTH,
    Kevin
    --
    Kevin Old <kold@kold.homelinux.com>

    Kevin Old Guest

  5. #4

    Default Re: Session Management

    Kevin,

    that's a bit more then we really wanted to get into for this project, plus
    portability is going to be an issue too. So it can be installed on serveral
    differnet servers. So we are thinking it be much easier to install either the
    Apache or CGI session modules. HTML::Mason is alot more then we really need. But
    appreciate the feedback.

    Thx's

    --
    Mike<mickalo>Blezien
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Thunder Rain Internet Publishing
    Providing Internet Solutions that work!
    [url]http://www.thunder-rain.com[/url]
    Quality Web Hosting
    [url]http://www.justlightening.net[/url]
    MSN: [email]mickalo@thunder-rain.com[/email]
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


    Kevin Old wrote:
    > On Fri, 2003-12-12 at 15:50, Mike Blezien wrote:
    >
    >>Hello,
    >>
    >>We are in the process of setting up a session management
    >>system for a complex membership system project. I've been
    >>reading through the docs on CGI::Session and Apache::Session
    >>and was hoping to get some feedback if one is preferred
    >>over another, the pros and cons of using one over
    >>another,... portability advantages,...etc. So anyone that's
    >>use both of these modules, any recommendations would be much
    >>appreciated.
    >
    >
    > Mike,
    >
    > I recommend using HTML::Mason and the MasonX::Request::WithApacheSession
    > module which does all the work for you. It is basically a Mason
    > interface to Apache::Session.
    >
    > I am working on a HOWTO for setting up a basic session with it, as the
    > POD isn't easy to follow.
    >
    > HTH,
    > Kevin

    Mike Blezien Guest

  6. #5

    Default Re: Session Management

    On Fri, 2003-12-12 at 16:08, Mike Blezien wrote:
    > Kevin,
    >
    > that's a bit more then we really wanted to get into for this project, plus
    > portability is going to be an issue too. So it can be installed on serveral
    > differnet servers. So we are thinking it be much easier to install either the
    > Apache or CGI session modules. HTML::Mason is alot more then we really need. But
    > appreciate the feedback.
    Mike,

    Well, in that case I'd suggest Apache::Session using the
    Apache::Session::File setup. All that's needed is to specify a
    directory on the server to write the session files to. It's the easiest
    and most "portable" I've found. Sorry I didn't get that you wanted
    portability most of all.

    HTH,
    Kevin

    --
    Kevin Old <kold@kold.homelinux.com>

    Kevin Old Guest

  7. #6

    Default Session Management

    Hello,
    I was wondering if anyone could help me.
    I have designed a site with a log in and password page.
    How would call the user name in queries on other pages?
    I am able to log in using the user name and password from my database but I
    can not get the queries to work when I call the user name, I have tried
    #session.MM_Username# and #Session.StaffID# (Staff ID being the field I have
    named the user id).
    Any help would be much appriciated.
    Thanks
    Michelle




    My code for LogIn
    <td><cfinput type="text" name="StaffID" required="yes" message="Please enter
    your Staff ID">
    <input type="hidden" name="StaffID_required" value="Please enter your Staff
    ID."></td>
    </tr>
    <tr>
    <td><h4><font face="Geneva, Arial, Helvetica,
    sans-serif">Password</font></h4></td>
    <td><cfinput type="password" name="Password" required="yes" message="Please
    enter your password.">
    <input type="hidden" name="Password_required" value="Please enter a
    password."></td>
    </tr>
    <tr align="center">
    <td colspan="2"> <input type="submit" value="Login"></td>
    </tr>
    </table>
    </cfform>

    and here is my query on another page within the site

    <cfquery name="Shifts" datasource="BookingSystemDSN">
    SELECT Job.Event, Job."Date", Location.LocationName
    FROM Job, Location, Employee,
    EmpShifts WHERE Location.LocationID = Job.LocationID
    AND EmpShifts.EmpID = Employee.EmpID
    AND EmpShifts.JobID = Job.JobID
    </cfquery>

    just need the Employee.EmployeeID to equal the StaffID input in the LogIn page


    Thanks again
    Michelle

    micb Guest

  8. #7

    Default Re: Session Management

    Michelle, try this:

    <cfquery name="Shifts" datasource="BookingSystemDSN">
    SELECT Job.Event, Job."Date", Location.LocationName
    FROM Job, Location, Employee,
    EmpShifts WHERE Location.LocationID = Job.LocationID
    AND EmpShifts.EmpID = Employee.EmpID
    AND EmpShifts.JobID = Job.JobID
    <cfif IsDefined('form.staffID') and len(form.staffID)>
    and employee.employeeid = form.staffID
    </cfif>
    </cfquery>

    <cfif shifts.recordcount gt 0>
    Log in successful
    <cfelse>
    Redirect back to login page
    </cfif>

    Now, if you want to use the ID on subsequent pages, you would either have to
    use cookies or session variables. But to use session variables, you must
    enable it within your Application.cfm page.

    Hope that this helps. Thanks.

    Chris
    </cfquery>


    cgsj_usa@yahoo.com Guest

  9. #8

    Default Re: Session Management

    Hi Chris,
    Thanks for your help, but I still cant seem to get it to work!
    I have already turned on the session variables, and have tired about 4 books
    and a number of websites but still cant seem to get it to work.
    How do I call the vairable from the log in?
    Thanks again
    Michelle x

    micb Guest

  10. #9

    Default Re: Session Management

    What do you mean you can't get it to work? What's the error?
    cgsj_usa@yahoo.com Guest

  11. #10

    Default Re: Session Management

    k well..

    A user logs in, next page shows a list of events..
    this query gets data from the databse and displays it.
    there is a link on this page to see what events the user has booked onto..
    so it needs to get the user ID they entered on the first page to find out what
    the specific events they have booked.
    I have it getting all the events anyone has booked onto but not that specifc
    individual!
    I used the code u kindly gave me and there are no error messages showing but
    it is still bringing up all the results and not just for that user!

    micb Guest

  12. #11

    Default Re: Session Management

    So, you've already gotten the login page to work?

    If so, on the login page, if login is successful, set a session variable to
    the user's login/employee/staff ID value (whichever corresponds to what
    identifies their events in the database) and use that going forward in any
    queries.

    Login form
    |
    ?
    Action form (directs the user to the page that shows the list of ALL
    results and the link to show what events they've registered for) On this page,
    you must also set the session variable for their ID (<cfset session.empID =
    form.staffID />). Then, when they click on the link, the query on that page
    should be like this:

    <cfquery...>
    ...
    and employee.employeeID = '#session.empID#'
    </cfquery>

    The results from this query should show only the events that they are
    registered for.

    If you don't understand this...you need to post all of your code for further
    assistance.

    Thanks.

    cgsj_usa@yahoo.com Guest

  13. #12

    Default Re: Session Management

    Yeah sorry the login does work!
    So
    <cfset session.empID = form.staffID />
    goes in the code for the LogIn page?
    Do I include it on every page after that?
    Sorry if I am being thick haha
    and thank you so much for your help!

    micb Guest

  14. #13

    Default Re: Session Management

    No, you don't have to include the cfset on every page after that. Once you set
    it, depending on your session timeout (you define this in the CFAdministrator
    and/or the Application.cfm page), you can access it on subsequent pages. You
    should use cflock around the cfset tag when reading and/or writing session
    variables.

    cgsj_usa@yahoo.com Guest

  15. #14

    Default Re: Session Management

    thanks... this is what I get when I do that tho!

    Element STAFFID is undefined in FORM.

    The Error Occurred in
    C:\CFusionMX\wwwroot\BookingSystem\BookingSystem\A pplication.cfm: line 9

    7 : scope="Session"
    8 : type="exclusive">
    9 : <cfset session.empID = form.StaffID />
    10 : </cflock>




    micb Guest

  16. #15

    Default Re: Session Management

    That's because you are using the form variable on the wrong page. You should
    use it on the action page of the form, not the Application.cfm page. You need
    to sit and read before you try to do anything further. Search the Macromedia
    site for tutorials and literature on persistent variables, using
    application.cfm, etc. This is the end of my road with you, so, if you don't
    want to read, just move the cfset tag out of the application.cfm page and put
    it on the action page of the form.

    Sorry and thanks...Chris

    cgsj_usa@yahoo.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139