$_SESSION and include()
Posted: Wed Jan 21, 2004 10:24 am
OK, problem:
I created a user registration form working. I decided to modify it for security reasons. What I did was have one page called profile.php include the appropriate files according to the URL. The problem is that when I include the files I can't send anything from profile.php to the included page. I can't send variables, $_SESSION variables, nothing! So here's my code:
profile.php
register.php
So in conclusion register.php will not print anything on the page when profile.php?mode=register&submit=true
I created a user registration form working. I decided to modify it for security reasons. What I did was have one page called profile.php include the appropriate files according to the URL. The problem is that when I include the files I can't send anything from profile.php to the included page. I can't send variables, $_SESSION variables, nothing! So here's my code:
profile.php
Code: Select all
<?php
require($_SERVER['DOCUMENT_ROOT'].'/.../functions.php');
$doc_root = DocRoot('http://www.rockpromo.com');
session_start();
if($_GET['mode'] == 'register') {
if($_GET['submit'] == 'true') {
$_SESSION['sub'] = true;
}
include($doc_root['local']."/.../register.php");
} else {
header("Location: ".$doc_root['local']."/index.php");
}
?>Code: Select all
<?php
session_start();
echo $_SESSION['sub'];
?>