Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Cookie Help Please

edited January 2008 in Vanilla 1.0 Help
I am currently working on a PHP site and have been asked to integrate the vanilla forum login to my login function. I have found a couple of good resources describing how those that came before me completed the task and have taken the approach of essentially maintaining two user tables (the user table for my site and the user table for the vanilla forums) so for example when a user is created for my site I insert the same user into the Vanilla users table. So far so good. I then attempted to create two cookies: setcookie("lussumocookieone", $user->get_user_id(), 0, "/", ".mydomain.com"); setcookie("lussumocookietwo", md5($user->get_verification_key()), 0, "/", ".mydomain.com"); However once this is done Vanilla doesn't seem to recognize these as valid cookies (no user is logged in). I deleted all my cookies and then tried my login function again and I see that there are 3 cookies set, a PHPSESSID (from the php side of my site) and the two lussumo cookies. However when I go into the Vanilla side of things and delete my cookies and log in again, there is only one cookie set as PHPSESSID so it would seem that Vanilla is setting a PHP session rather than using lussumocookieone and two. Is there something that I am missing in the settings.php file? Is there a way to force Vanilla Forums to want o use the lussumocookies instead of hte PHP session? One thing that I thought about doing was changing the cookie to .mydomain.com/forum. The thought here was that since there is a PHPSESSID set as .mydomain.com that Vanilla is trying to use that if it is checking for the session id cookie first. Thanks in advance for any help on this problem. -Lapith

Comments

  • There are classes built into the people libraries designed to take care of signing users in and out etc based on login credentials. Check out the Authentication class...
  • Thank you for the response. I will take a look at the authentication class tonight. I wonder if there is something specific that you had in mind as far as changing my approach or working with something in the Authentication class to handle my specific case.
  • Well it will do the cookie creation etc for you (everything required for vanilla to know who a user is, basically) so it should take a load of work off your hands.
  • However, this problem is probably a domain/path/session mismatch.
    Did you check if domain/path of cookies created by your php and those by Vanilla are the same or, at least that yours supersedes Vanilla's?
    Oh, BTW, Vanilla only creates cookies if the "remember me" option is checked in the login panel. You might want to default check it.
This discussion has been closed.