Ask a Question related to Coldfusion Database Access, Design and Development.
-
Mike Blezien #1
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
-
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... -
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... -
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... -
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... -
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... -
Mike Blezien #2
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
-
Kevin Old #3
Re: Session Management
On Fri, 2003-12-12 at 15:50, Mike Blezien wrote:
Mike,> 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.
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
-
Mike Blezien #4
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
-
Kevin Old #5
Re: Session Management
On Fri, 2003-12-12 at 16:08, Mike Blezien wrote:
Mike,> 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.
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
-
micb #6
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
-
cgsj_usa@yahoo.com #7
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
-
micb #8
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
-
cgsj_usa@yahoo.com #9
Re: Session Management
What do you mean you can't get it to work? What's the error?
cgsj_usa@yahoo.com Guest
-
micb #10
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
-
cgsj_usa@yahoo.com #11
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
-
micb #12
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
-
cgsj_usa@yahoo.com #13
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
-
micb #14
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
-
cgsj_usa@yahoo.com #15
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



Reply With Quote

