ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

using uniqueid for login status on non-EE page

October 26, 2012 9:49am

Subscribe [1]
  • #1 / Oct 26, 2012 9:49am

    PDM

    61 posts

    Hello,

    I just updated to 2.5.3 and see that one of my functions is now broken. It was used so that a member logged into EE would remain logged in on some non-EE pages on the site.

    Looks like the uniqueid cookie status is deprecated, and I’m wondering how to go about doing this now. Here’s the original query:

    $query = "select unique_id, username from exp_members where unique_id = '$_COOKIE[exp_uniqueid]'";
        $conn = mysql_query($query)
        or die ("Cannot execute query");
        if (mysql_num_rows($conn)<1) { ...

    Thank you.

  • #2 / Oct 29, 2012 11:44am

    Kevin Smith

    4784 posts

    Hi PDM,

    I’m not seeing reference to that cookie in any recent versions, and I know the members authentication library has changed significantly since EE 2 was first released. Could you let me know which version you upgraded from? In which EE version was this working the way you describe?

  • #3 / Oct 29, 2012 12:11pm

    PDM

    61 posts

    Hi Kevin,

    I’d updated from 2.1.1-20101020 to 2.5.3-20120911. Thanks for checking this out.

  • #4 / Oct 30, 2012 11:49am

    Kevin Smith

    4784 posts

    Yep, looks like all references to that cookie are non-existent as of EE 2.2.0.

    Could we take a step back and look at what you’re trying to accomplish? What does it look like and why do you need folks “logged in” on non-EE pages? There might be a better way to do this.

  • #5 / Oct 30, 2012 12:40pm

    PDM

    61 posts

    That would explain the break! Short story is it’s a site in transition, and the log in area is at the top of all pages (both EE and non-EE), and so need a persistent log-in status throughout the site.

    Good news is I just figured out a solution this morning by adding a session_start() call and setting a PHP session variable on the page that loads after log-in, and then tweaked the above query to:

    session_start(); 
     $query = "select unique_id, username from exp_members where member_id = '$_SESSION[exp_uniqueid]'";

    Feel free to close thread. Thanks!

  • #6 / Oct 31, 2012 5:18pm

    Kevin Smith

    4784 posts

    Glad to hear you found a solution! Let us know when we can help again.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases