Reply to this question.
Source of the problem
I found out that the problem was in my handle_login_session.php
-file at the very beginning of my index.php. I had this there
The very beginning of my index.php in the file handle_login_session.php
if( $_SESSION['login']['logged_in'] == false ){
$random_number = rand(1,100000);
$session_id = session_id($random_number);
$_SESSION['login']['email'] = ''; // problem here
}
I did not think that this could be a problem when making this because I have the following at the very end of my file
The end of my index.php in the file handle_registration.php
$email = $_POST['login']['email'];
$_SESSION['login']['email'] = "ntohuh"; // not effective
I had the idea that the code later in my index.php will overwrite the code before it. However, this is not the case here.
Explanation for the problem
I have one explanation for the strange behaviour.
The latter file is called by the following form in my index.php.
<?php
echo ("<form method='post'"
. "action='/codes/handlers/handle_registration.php" // called here
. "'>"
);
?>
<p>Email:
<input name="login[email]" type="text" cols="92" />
</p>
<input type="submit" value="OK" />
</form>
This action seems to make like an external environment which does not overwrite anything in the main environment.
The following picture summarizes the situation where the order of the files being called is shown.
handle_login_session.php ---- handler_registration ------
| |
index.php ----------------------------------------------------------------------->
time