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.

lussumocookieone outside of vanilla.

edited January 2007 in Vanilla 1.0 Help
I searched these boards for days trying to figure out how to do what I wanted to do. I learned enough to put together my own *small*, very *small* script to detect if a cookie is set on my homepage website then display my login/logout text...

I changed my cookie path from '/forum/' to '/'.

My question: Is there a better/faster or more secure way of doing this utilizing Vanilla's framework?

// Auth Includes. include('../forum/appg/settings.php'); include('../forum/appg/init_people.php'); // Is a cookie set? if (isset($_COOKIE['lussumocookieone'])) { // Cookie set! $userNameQuery = mysql_query("SELECT Name FROM LUM_User WHERE UserID='" . $_COOKIE['lussumocookieone'] . "'"); $userName = mysql_fetch_assoc($userNameQuery); $authMessage = 'You are logged in as <a href="../forum/account.php?u=' . $_COOKIE['lussumocookieone'] . '"><b>' . $userName['Name'] . '</b></a> (<a href="../forum/people.php?PostBackAction=SignOutNow">logout</a>).'; } else { // Cookie not set. $authMessage = 'Feel free to <a href="../forum/">login</a> or apply for an <a href="../forum/people.php?PostBackAction=ApplyForm">interactive membership</a>.'; } echo $authMessage;

I also saw a code around here that tested if $Context->$User->$UserID $Context->Session->UserID was set...but that seemed to only be Sessions and not persistent cookies.

Any help or direction would be great. Thanks.

Message was edited on 1/23/2007 at 6:03 Central Time.


  • StashStash
    edited January 2007
    This forum doesn't use BBCode, try changing your [code] tags to <code>.

    I'm interested in this, so I'll be interested to see what people more knowledgeable than me say about it.
  • you should be able to just check $Context->Session->User->UserID, the info is filled out by the Authenticator class based off the cookies, so it's not just temporary sessions.
  • edited January 2007
    To [-Stash-], thanks for the code tip.

    To everyone, Initially I found aanand's post (pasted below) that tested $Context->Session->UserID. It worked as long as I did not close the browser. Now I go back to that code and it works just perfect IF I changed my cookies path from '/forum/' to '/' inside conf/settings.php.

    include("./vanilla/appg/settings.php"); include("./vanilla/appg/init_people.php"); if ($Context->Session->UserID) { echo "You are logged in as <b>{$Context->Session->User->Name}</b>."; } else { echo "You are not logged in."; }

    And when I use SirNot's variable ($Context->Session->User->UserID) I get the same result -- so in reality, all I had to do was change my cookie path?

    Now a side minor question: What is the difference between $Context->Session->User->UserID AND $Context->Session->UserID (leaving Session out).
  • Wheeeeeeeeeeeeee<b>$Context->Session->User->UserID</b> AND <b$Context->Session->UserID</b> (leaving Session out).</b$context->
    Is that the tag police you mentioned previously SirNot?

    Your whole post is bold PureLuckk, I *think* you've used <b instead of <b> just after the AND in the last sentence and that's why it's all bold and not displaying everything you want it to at the end of your comment. I think you meant:

    Now a side minor question: What is the difference between $Context->Session->User->UserID AND $Context->Session->UserID (leaving Session out).
This discussion has been closed.