Forum Moderators: coopster
if(isset($_SERVER["HTTP_REFERER"])) {
session_register("backurl"); $_SESSION["backurl"]=$_SERVER["HTTP_REFERER"];
//session_register("try"); $_SESSION["try"]="TRY";
}
The code itself is pretty easy.
When remove the // of the second line, $_SESSION["try"] is registered and appear in my session file. So what can be wrong with the $_SESSION["backurl "] knowing that:
The $_SESSION["backurl"] is in fact registered (since echo $_SESSION["backurl"] give me what I want), it is just that when I am trying to see its value in the session file, I DON'T SEE IT!
I have not found the problem yet, but still looking and making progress. Very very strange behaviour though.
1/ I have an include called "kill_back_session.php" that session_unregister("backurl"). When removing this line, "BACKURL" appear in my session file. My conclusion is that the include is called somewhere in my PHP webpage and unregistering the session.
2/ I have added echo $_SESSION["backurl"] at the end of the page and it works fine, so if the include is called it is not in the page?
3/ I have added some text in the include to find out where it is called and see nothing.
How can it be? Really strange!
The include looks like this
<?php
echo 'text<br>text<br>text<br>text<br>text';
//echo 'de
session_register("try"); $_SESSION["try"]="HELP";
?>
1/ The include is never called but $_SESSION["try"] is still set.
2/ I do not see any text (1st line).
3/ When removing the // (2nd line), it should give an error message, but it doesn't and $_SESSION["try"] is not set.
It become ridiculous!
Nice WE
If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.
And we all know how we should be treating register_globals [php.net], correct?
session_register [php.net]