Hi, Okay, I figured that I will have to make them use the same session in the case that the browser has disabled cookies. For example, when I tested my site on IE6 with default settings, it was seemingly unable to detect the SMF cookie.
So it seems that I will have to somehow synchronize between the sessions--i.e. not create a forum session if there's already a cakephp session and vica versa (unless there's a better way to do it? i.e. overwrite the cakephp session once the forum session has been created?). I think the SMF session_id is stored in the SMF cookie so would the solution be checking if that cookie is set and if so, rewriting the session id using session_id($smfid)? Also, if this is indeed the solution, would I basically have to be editing the functions in cake/cake/libs/session.php? Thanks again- Sohum. On Aug 4, 7:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > Any suggestions on fixing the cookie/session issues? I've managed to > have Cake discover when someone is logged in/out in SMF but I was > wondering if I should force them to use the same session and if I > should, how I should go about doing something like that. > > - Sohum. > > On Aug 3, 5:51 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Hi again, > > > Okay, so I finally experimented enough and got cookie sharing working. > > However, since CakePHP rewrites the cookie every time a page is > > loaded, if I login to SMF, go to the cake section and then go back to > > SMF, I have to login again. I figure I need to direct Cake to use > > SMF's cookie data (or vica versa--but SMF's cookie data is much more > > complex), right? > > > Also, both Cake and SMF create their own session id's. Although I > > could survive by using the SMF cookie for everything (and hence > > getting the SMF session id from there) and ignoring the Cake cookie > > completely, I was wondering if there was a compelling reason to make > > them use the same session. > > > Thanks, > > > -Sohum. > > > On Aug 3, 5:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > > > Okay, that makes sense. I will go ahead and do this but I have another > > > question which I may need to address. > > > > The data stored in the two cookies are different. It seems CakePHP > > > stores the session ID (right?) whereas SMF stores the session ID in > > > some sort of scrambled format. Would it matter which application > > > created the cookie first? Does CakePHP ever overwrite cookies or would > > > the setcookie call from SMF be sufficient to overwrite the initial > > > cookie created by Cake? > > > > -Sohum. > > > > On Aug 3, 4:40 pm, "Geoff Ford" <[EMAIL PROTECTED]> wrote: > > > > > Ok that sheds some light - the two cookies will have different paths > > > > associated with them. > > > > > Correct me if I am wrong but you are using smf to log a user in. This > > > > creates a cookie with the path /forum associated with it. When you go > > > > to / > > > > or /controller Cake cannot access the cookie because it is outside the > > > > path. > > > > > You need to find where in smf the cookie is being set and either change > > > > or > > > > add a path to the setcookie() call so that the path is set as the root > > > > level > > > > path. This will make the cookie available to the entire domain > > > > including > > > > all the cake controller/action paths. > > > > > Fromhttp://php.net/setcookie > > > > *path* > > > > > The path on the server in which the cookie will be available on. If set > > > > to > > > > '/', the cookie will be available within the entire *domain*. If set to > > > > '/foo/', the cookie will only be available within the /foo/ directory > > > > and > > > > all sub-directories such as /foo/bar/ of *domain*. The default value is > > > > the > > > > current directory that the cookie is being set in. > > > > Geoff > > > > > On 8/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > Also, not sure if this will help, but browsing to the forum creates a > > > > > new cookie by the same name as CakePHP (since I changed CakePHP's > > > > > session name to be the same as SMF). I verify this using web developer > > > > > toolbar's cookie information tool. There are two cookies, both by the > > > > > name SMFCookie655, both containing different information. > > > > > > - Sohum. > > > > > > On Aug 3, 3:11 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > > > wrote: > > > > > > Hi Geoff, > > > > > > > First of all, thanks for your response. > > > > > > > Now, the SSI.php file that SMF provides for includes has defined a > > > > > > bunch of functions that have the prefix ssi. For example, the > > > > > > function > > > > > > ssi_welcome() prints out a welcome message (Welcome back username, > > > > > > you > > > > > > have x messages) or a login message (Welcome guest. Please login or > > > > > > register) depending on the session information. There is also a > > > > > > provided ssi_examples.php file that shows the output of all these > > > > > > functions. > > > > > > > Now when I'm logged out, of course everything works. The user is > > > > > > logged out and all the functions behave like that. When I then login > > > > > > to SMF, the ssi_examples.php functions all update, but the same > > > > > > function calls in my layouts, it still treats the user as not logged > > > > > > in. Printing out the SMF contextual data confirms this--CakePHP > > > > > > doesn't "update" the session data it seems. > > > > > > > I have included the "SSI.php" in my layout file. Perhaps I should > > > > > > include this somewhere else? Although that doesn't seem like the > > > > > > solution. > > > > > > > - Sohum. > > > > > > > On Aug 3, 10:38 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > > > > > > > > What are the ssi calls - From my understanding Cake shouldn't > > > > > > > need to > > > > > > > use these. Cake will just add its own keys to the existing > > > > > > > session (I > > > > > > > think). > > > > > > > > The only trouble you might have is if cake and smf use the same > > > > > > > key > > > > > > > and one overwrites the other all the time (not sure that this will > > > > > > > happen, just that it could) > > > > > > > > Geoff > > > > > > > --http://lemoncake.wordpress.com > > > > > > > > On Aug 3, 12:30 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > > > > > wrote: > > > > > > > > > Hi, > > > > > > > > > I checked out the two threads regarding integration of Simple > > > > > Machines > > > > > > > > Forum (SMF) and CakePHP but was unable to get far. I posted > > > > > something > > > > > > > > in one of those threads, but it seems to have gotten lost. So > > > > > anyways, > > > > > > > > here's my post: > > > > > > > > > I have come across a little bit of trouble while using the SMF > > > > > > > > API. > > > > > > > > > Even when I do > > > > > > > > > <?php > > > > > > > > require_once("forums/SSI.php"); > > > > > > > > // ssi_* calls > > > > > > > > ?> > > > > > > > > > I am unable to get access to the SMF session data. I'm sure I'm > > > > > doing > > > > > > > > something stupid seeing that I'm not really knowledgeable at all > > > > > when > > > > > > > > it comes to PHP sessions, so here's what I did, so anyone can > > > > > > > > figure > > > > > > > > out: > > > > > > > > > 1. I installed CakePHP as it comes out of the box. > > > > > > > > 2. I installed SMF to the same database as CakePHP under > > > > > > > > webroot/ > > > > > > > > forums > > > > > > > > 3. I included the above require call in my default.thtml. > > > > > > > > 4. I set CAKE_SESSION_COOKIE to SMFCookie655 (which is what it > > > > > > > > is > > > > > for > > > > > > > > SMF) and changed management to database. > > > > > > > > 5. I changed CAKE_SESSION_TABLE to forums_sessions, which is > > > > > > > > where > > > > > the > > > > > > > > SMF session are kept. > > > > > > > > 6. I added the "expires" field to the forums_sessions table. > > > > > > > > 7. I made minor modifications to lib/sessions.php to make sure > > > > > > > > that > > > > > > > > _read, _write, etc. worked correctly (SMF stores session id in a > > > > > > > > session_id field, whereas Cake stores it in id) > > > > > > > > > When I viewhttp://path/to/forums/ssi_examples.php, all the data > > > > > > > > is > > > > > > > > populated correctly. However, when I call any function from > > > > > > > > within > > > > > the > > > > > > > > Cake layout, the data is blank. > > > > > > > > > It seems to me that in Cake's call to the SSI functions, it > > > > > > > > attempts > > > > > > > > to populate data using the information from the Cake session. > > > > > > > > Regardless of the way everything is set-up, it seems Cake > > > > > > > > creates > > > > > it's > > > > > > > > own cookie and SMF creates it's own cookie. Should it do this? > > > > > > > > > Any help will be appreciated. :D > > > > > > > > > - Sohum. > > > > > --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 -~----------~----~----~----~------~----~------~--~---
