instead of $DOCUMENT_ROOT, or $_GET['id'] from the URL
http://www.example.com/test.php?id=3 instead of $id, or
$_ENV['HOME'] instead of $HOME.
For related information on this change, read the configuration entry for register_globals, the security chapter on Using Register Globals , as well as the PHP » 4.1.0 and » 4.2.0 Release Announcements.
Using the available PHP Reserved Predefined Variables, like the
superglobal arrays, is preferred.
<?php
// File : onlytest1.php
session_start();
$a = 5000 ;
$_SESSION['a'] = $a ;
header ('location:onlytest3.php');
?>
<?php
// File : onlytest3.php
session_start();
$b = $_SESSION['a'];
if (!isset($b))
{
echo 'Error';
}
else
{
echo $b ;
}
?>
<?php
// File : onlytest4.php
session_start();
unset($_SESSION['a']);
header ('location:onlytest3.php');
?>