PHP $_SESSION info gets lost from an external login page to a WP Installation (3 posts)

  1. racl101
    Posted 7 years ago #

    I'm having problems trying to make a WordPress installation into a restricted area and part of a login system where the login page sits outside the WordPress installation. Could somebody help me figure out what is going on?

    So in summary here's what is happening:
    -The users try to login through a login page that sits outside the WordPress files folder (which I called 'cms').

    -The $_SESSION variables work when called in any pages that are not inside the 'cms' (WordPress) folder. This also implies that my site is using non-WP pages as well in case you're wondering.

    -However, when I try to call in these $_SESSION variables inside a WP page the information is lost. (i.e there's no data inside these variables because they're empty.) The assumption here is that I navigate from a non-WP page to a WP page in my site through a link.

    Now this problem is not straight forward because:

    i) I have tried using $_SESSION variables inside a WP installation and they Do work when they are set within WordPress. However, as I described above, these a variables are being set outside of WordPress because I have a lot of non-WP pages as part of my site.
    Therefore, I know at the very least that I can use PHP sessions inside WordPress even though WP doesn't make use of them by default.

    ii) This weird behavior of loss of $_SESSION data fron non-WP pages to WP-pages happens mainly when I try to test the site on all browsers in Windows machines. I couldn't tell there was an error when I was testing on Mac OS X, which is what I'm using to code.

    By the way, the server running my PHP installation is a Linux Server and it is running PHP 5 Version 5.2.6 if that helps.

    Sorry for the long winded question.

  2. timfox89
    Posted 7 years ago #

    I am having the same problem with wordpress, sessions work inside of word press and as long as the session is started in wordpress it passes to the rest of the site outside of the blog. But if the session is started from outside the blog and then the user enters the blog the session appears to be lost completely.

    I'm working on WordPress 2.8.2 installed on Linux with Apache, browser is Firefox 3.0.11

    Any hints would be much appreciated.

  3. madwax
    Posted 6 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic