0

Hi,

I'm running into a strange issue on my iPage hosted version of my website. When logging into my system, $_SESSION["id"] contains the User ID of the logged in user. Somewhere else on my site I am doing something like this to retrieve the ID of a page:

    if (isset($_GET["id"])) {
        $id = $_GET["id"];

        // Do something with the $id.
    }

However, this actually seems to change the value of $_SESSION["id"]. I tried doing the following to confirm this:

    if (isset($_GET["id"])) {
        echo $_SESSION["id"];
        $id = $_GET["id"];
        echo $_SESSION["id"];
    }

This doesn't happen when running my website on my local LAMP environment. Can anyone tell me why this is happening and how to remedy it?

Thank,
Jonathon

3
Contributors
4
Replies
36
Views
3 Years
Discussion Span
Last Post by bops
1

Might be that your webhost has register_globals enabled. Register_globals is deprecated since PHP 5.3, so if this is the case, your webhost is running an older PHP version. I guess you can see if register_globals is turned on or off by using phpinfo(), but I'm not sure.

Edited by minitauros

0

Thanks for the suggestion. I've tried turning register_globals off through .htaccess but it causes me to get a 500 error. I've tried to reproduce the problem at home on my WAMP server but I am unable to reproduce it regardless of the register_globals setting. Any more ideas?

0

Thanks for your suggestion Minitauros. I've had my web host turn off register_globals for my site and it seems to have done the trick. I wondered why I was unable to reproduce the problem at home on my WAMP server but I've just noticed it's running PHP 5.4 in which register_globals was removed.

Thanks again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.