Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8502839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:35:48+00:00 2026-06-11T01:35:48+00:00

I have a domain. Let’s call it www.example.com for this question. Thanks to the

  • 0

I have a domain. Let’s call it http://www.example.com for this question. Thanks to the wonders of how I have things setup and/or WordPress, if I were to type in example.com it would redirect me to http://www.example.com and WordPress would do its thing. I also have a subdomain called members.example.com in which I have built a rather elaborate system using CodeIgniter into the folder /members off of public_html.

In a perfect world, what I would like to do is be able to put some php code into WordPress that would allow someone reading the “www” side of things to be able to determine if they are also currently logged in on the “members” side of things. I know the CodeIgniter session persists so that whenever I jump on to the members side, I’m still logged in. My first thought was to put together a quick page in CI that did this:

public function isLogged()
{
    $x = "off";
    if ($this->session->userdata('memberKey') != 0) {
        $x = "on";
    }
    echo $x;
}

Then, whenever I would run the link members.example.com/login/isLogged , I would always get either “off” or “on” to determine if I was in or not. The memberKey would be either 0 for not logged in, or a number based on someone’s corresponding key in the database. My hope was that I would be able to run something like THIS from the www side (within WordPress)

$homepage = file_get_contents('http://members.example.com/login/isLogged');

…and I would be able to act on whether the person was logged in or not. Well, obviously the flaw here is that when I call the above function, I’m always going to get “off” as my result because I’m making that call from the server, and not from the client in question that needs this information.

What would be the most elegant solution to being able to read this information? Is there a way to read cookies cross platform?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:35:50+00:00Added an answer on June 11, 2026 at 1:35 am

    Well, I realized that I worked through the process, and I don’t want to leave anyone hanging, so my solution was this:

    First, I know that for my cookies, I went into codeIgniter’s /application/config/config.php and put the following in as my cookie domain (line 269 – and I’ve changed the domain name here to protect my client, obviously)

    $config['cookie_domain']    = ".example.com";
    

    I’m being careful here, and using the “.” before the domain to cover all subdomains.

    I also know that I’m writing my session data to a database. So, on the WordPress side of things, I put in this code at a certain location:

    $memCCinfo = unserialize(stripslashes($_COOKIE['ci_session'])); // Changed for OBVIOUS reasons
    $mysqli = mysql_connect('localhost', 'NAME', 'PASSWORD'); // Changed for OBVIOUS reasons
    $mysqlDatabase = mysql_select_db('DATABASE',$mysqli); // Changed for OBVIOUS reasons
    $isLoggedCC = "off";
    $sessInfoQry = mysql_query('SELECT user_data FROM ci_sessions WHERE session_id = "' . $memCCinfo['session_id'] .'"',$mysqli);
    while ($sessInfo = mysql_fetch_assoc($sessInfoQry)) { 
        $breakOutInfo = unserialize(stripslashes($sessInfo['user_data']));      
        if (is_array($breakOutInfo)) { $isLoggedCC = "on"; }
    }
    

    Then, I now have a way to determine if a member is logged on to the “members” side or not. Question is… are there any holes in what I’m doing that I should worry about?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have the domain http://www.example.com . When I browse to http://www.example.com/12345 it
I have 10 systems hosted in the same domain let's call it (domain.com). I
I have a client. Let's say their domain is www.mydomain.com. We are creating a
Example current URL http://www.domain.com/subdomain/install/finish.php I use this code to get the current URL. $url
For example, let's say I have domain.com. Can I configure http://subdomain1.domain.com to be hosted
I have a domain... let's say www.myOldDomain.com. It is currently running a site about
I have a primary domain - let's call it xyz.com . I also have
We have a domain name with various TLDs. Let's use example.com as our main
I'm confused about MVC routes. Let's say I have this domain: poopoopants.com. I want
I have a domain I bought (via godaddy.com) - let's call it xyz.com I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.