[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] cgi::app, cgi::session & https


> My first thought is to just use different run modes and make use of header
> redirect's.

I did something like this. But, I ended up getting rid of cgi::session and
writing my own little session manager.  For a few reasons. I felt
cgi::session provided more than I needed. And, if I did my own I could do
some things peculiar to my own requirements.

One thing I do is store the page the user was last at. For example, if the
user goes to a lookup page, and the cgi_prerun determines the user is not
logged in (new visit or login expired due to inactivity?) it will create the
session, set the "last at" value and then set the header to redirect to the
login page using https. cgi_prerun sets the run_mode to a mode which emits
nothing (so the header kicks in without any page being sent to the browser.
At the login script, it does the login and then, if the "last at" value of
the session is set, it redirects back to that page (without https). If it's
not set (maybe the user came directly to the login), it just redirects to
main page (without https).

It works pretty good. Every instance script has the same logic in the
cgi_prerun. They each have the same teardown method to update the session
automatically when the instance ends. If I could figure out how to do a
superclass, I suppose I could put all this into one superclass and inherit
it across all the instance scripts.

I created my session tool to be an object and store stuff in MySQL. It's
specific to my use. But, if you want it I'd be happy to give it to you. You
could define your session table and then change all the SQL to reflect your
table.

Mark


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.