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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to