Ok - didn't think about the different column names.
Maybe you could extend the SessionComponent as SmfSessionComponent to make
it a bit cleaner and more portable and put that in Cake snippets or the
bakery or somewhere for other people who want to integrate SMF and Cake.
SMF seems to be gaining a bit of a following so I am sure other bakers will
appreciate something like this.
Geoff
On 8/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Yes, that is pretty much what I have ended up doing (albeit through a
> long-winded process). I did actually have to modify Cake's session
> functions because the SMF sessions table uses different column
> headings and stores some more data. Also, SMF sessions stores session
> id in a field session_id whereas Cake stores it in id (or maybe its
> the other way around). Seeing that Cake's session handling functions
> are in an easily accessible location and SMF's are stored away in some
> place I couldn't find, I went ahead and modified Cake's.
>
> - Sohum.
>
> On Aug 8, 2:55 pm, "Geoff Ford" <[EMAIL PROTECTED]> wrote:
> > You don't need to modify cake. All you have to do is modify
> config/core.php:
> >
> > define('CAKE_SESSION_SAVE
> > <
> http://api.cakephp.org/1.2/app_2config_2core_8php.html#ebaae21321d4c6...
> >',
> > 'database'); // sets cake to use database sessions
> > define('CAKE_SESSION_TABLE
> > <
> http://api.cakephp.org/1.2/app_2config_2core_8php.html#c65b43b5806945...
> >',
> > 'forumprefix_sessions'); // tells cake which table to use
> > define('CAKE_SESSION_COOKIE
> > <
> http://api.cakephp.org/1.2/app_2config_2core_8php.html#daabb9dafb18df...
> >',
> > 'PHPSESSID'); // tells cake which cookie holds the session id
> >
> > Thats all that you should need to do.
> >
> > Then from within cake you can call the ssi_ functions as normal and all
> > should be fine.
> >
> > Geoff
> >
> > On 8/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Yes, that is exactly what I wanted to do (use the SMF hooks using the
> > > provided SSI.php) but since SMF relies on the session data for these
> > > to work and Cake created its own session to handle this, the SSI.php
> > > file was not looking at the correct data. In all, the steps I have
> > > taken were not that complicated--it was just the intermediate
> > > experimentation that made it seem difficult.
> >
> > > Basically what I did was:
> >
> > > 1. Set SMF to use only global cookies.
> > > 2. Set CAKE_SESSION_COOKIE to be the default 'PHPSESSID'.
> > > 3. Modify the session handling functions in Cake to use the MySQL
> > > table used by SMF (forumprefix_sessions)
> >
> > > I do believe it is working now on both IE6 and Firefox (more testing
> > > required, of course). Both applications use the same session so my
> > > only problem would be if the hard-coded session variables stored by
> > > Cake conflict with those stored by SMF. I'm not sure if there will be
> > > any security issue, though I do not foresee one (in my limited
> > > knowledge).
> >
> > > Perhaps another solution would be to modify SMF's SSI.php file to set
> > > the session ID temporarily to the one used by SMF and then set it back
> > > again for the one used by Cake. I'm not sure if this would interfere
> > > in regeneration of session ID's, though, so I'm quite happy to stick
> > > to my current solution!
> >
> > > - Sohum.
> >
> > > On Aug 8, 12:45 pm, MrTufty <[EMAIL PROTECTED]> wrote:
> > > > For the record, I think you've gone a very much more complicated way
> > > > around this than was necessary - I may be wrong, depending on
> exactly
> > > > what you're trying to achieve, but wouldn't it have been simpler to
> > > > hook into the SMF login/logout scripts from within your Cake apps?
> > > > That way you would still effectively have 2 sessions, which would
> > > > contain the same data (because you've written it to do that) but the
> 2
> > > > applications would be sharing information. I don't know what SMF's
> > > > support is for doing stuff like that, I know that some of the other
> > > > forum software allows it though.
> >
> > > > I'm just very confused as to what you're trying to do...
> >
> > > > Tufty
> >
> > > > On Aug 8, 8:06 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > > wrote:
> >
> > > > > Hi,
> >
> > > > > It looks like I have solved the problem. SMF stores the session ID
> as
> > > > > default in the PHPSESSID cookie. Since CakePHP is checking it's
> own
> > > > > cookie for the session ID and cannot find it, it creates another
> > > > > cookie. So I solved the problem (I think) by changing CakePHP to
> > > > > simply use the PHPSESSID cookie for it's session. This way,
> regardless
> > > > > of which creates the session first (Cake or SMF), they use the
> same
> > > > > session.
> >
> > > > > Is there a compelling reason that Cake was built to store it in a
> > > > > different cookie apart from flexibility (for example--security)?
> > > > > Thanks again.
> >
> > > > > - Sohum.
> >
> > > > > On Aug 7, 2:58 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > > > wrote:
> >
> > > > > > Hi,
> >
> > > > > > I had actually tried this solution earlier but it seems that
> CakePHP
> > > > > > only stores the session ID as a string in the cookie, whereas
> SMF
> > > > > > seems to store other data as well. There may be a way to change
> SMF
> > > to
> > > > > > have session-based data storage rather than cookie-based, which
> is
> > > > > > something I will check in the SMF documentation. It also seems
> as if
> > > > > > CakePHP rewrites that cookie on every pageload, because when I
> tried
> > > > > > manually setting the CakePHP cookie to point to a different
> session
> > > > > > ID, it got rewritten on page reload.
> >
> > > > > > I'll see if I can figure out also from the SMF forum what
> exactly is
> > > > > > being stored in that cookie. Is it hard to completely disable
> the
> > > Cake
> > > > > > Session component? It seems like it could be a lot easier just
> for
> > > the
> > > > > > SMF session to be used for everything and CakePHP sessions not
> be
> > > > > > created.
> >
> > > > > > I'll play around for a couple more hours to see if I can make
> any
> > > > > > progress.
> >
> > > > > > - Sohum.
> >
> > > > > > On Aug 7, 2:52 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > The cookies need to be the same name. They are looking for
> > > different
> > > > > > > cookies that tell what the session id is.
> >
> > > > > > > Geoff
> > > > > > > --http://lemoncake.wordpress.com
> >
> > > > > > > On Aug 7, 2:39 am, "[EMAIL PROTECTED]" <
> [EMAIL PROTECTED]>
> > > > > > > wrote:
> >
> > > > > > > > Hi,
> >
> > > > > > > > Currently they are both using the database version of
> storing
> > > session
> > > > > > > > data. I am confused, then, why a new session is created when
> one
> > > goes
> > > > > > > > from one area of the site to another. For example, if I go
> into
> > > the
> > > > > > > > Cake portion first, then a CAKEPHP cookie is created with a
> new
> > > > > > > > session id that is added to the database. When I go to the
> SMF
> > > > > > > > section, another session is created and another cookie is
> > > created
> > > > > > > > (SMFCookie655). Is this because they have different cookie
> > > names? The
> > > > > > > > SMF path is "/" whereas the Cake cookie path is the cake
> > > application
> > > > > > > > directory. They will both be the same on the production
> server,
> > > > > > > > though.
> >
> > > > > > > > - Sohum.
> >
> > > > > > > > On Aug 7, 3:59 am, "Geoff Ford" <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > > > > > I don't know the details of the cake session component, or
> > > sessions in
> > > > > > > > > general, but I believe that the sessions work by creating
> a
> > > cookie with a
> > > > > > > > > unique code. This code points to the session file (or db
> > > record) where the
> > > > > > > > > session data is stored.
> >
> > > > > > > > > So from my understanding, as long as both smf and cakephp
> use
> > > the same
> > > > > > > > > cookie name, and that cookie has a path that is high
> enough in
> > > the domain
> > > > > > > > > path to cover both applications, then they will share the
> > > session data.
> >
> > > > > > > > > If smf is using a custom session handler, such as a
> database
> > > or similar, you
> > > > > > > > > will have to replicate that session handler for the cake
> > > stuff. If they are
> > > > > > > > > both using the built in php file based session there
> should be
> > > no drama.
> >
> > > > > > > > > Geoff
> >
> > > > > > > > > On 8/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > > > > > > Hmm.
> >
> > > > > > > > > > Maybe I should just ignore Cake sessions? Do sessions
> also
> > > have a path
> > > > > > > > > > defined, and would this path have to be set to the
> server
> > > root or the
> > > > > > > > > > cake root in SMF for that session data to transcend to
> the
> > > Cake
> > > > > > > > > > application? I cannot see why else Cake would create a
> new
> > > session
> > > > > > > > > > when there was already a session defined on that domain.
> >
> > > > > > > > > > - Sohum.
> >
> > > > > > > > > > On Aug 6, 7:38 pm, "Chris Hartjes" <[EMAIL PROTECTED]>
> > > wrote:
> > > > > > > > > > > On 8/6/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > > > > > > > > How do I change the Cake session id to something of
> my
> > > choice?
> > > > > > > > > > > > Basically, I want to put in a check on every page
> load
> > > to see if the
> > > > > > > > > > > > forums session id has been created and if so, set
> the
> > > cake PHP session
> > > > > > > > > > > > id to that, so that both applications use the same
> > > session ID's.
> >
> > > > > > > > > > > In my opinion you will have to create your own custom
> > > session handler
> > > > > > > > > > > in order to accomplish this.
> >
> > > > > > > > > > > --
> > > > > > > > > > > Chris Hartjes
> > > > > > > > > > > Senior Developer
> > > > > > > > > > > Cake Development Corporation
> >
> > > > > > > > > > > My motto for 2007: "Just build it, damnit!"
> >
> > > > > > > > > > > @TheBallpark -http://www.littlehart.net/attheballpark
> > > > > > > > > > > @TheKeyboard -http://www.littlehart.net/atthekeyboard
> >
> > > > > > > > > --http://lemoncake.wordpress.com
> >
> > --http://lemoncake.wordpress.com
>
>
> >
>
--
http://lemoncake.wordpress.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---