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.
- The topic ‘PHP $_SESSION info gets lost from an external login page to a WP Installation’ is closed to new replies.