# The following prints:
# /abu-jeib/teaching/Fall_06/207/Examples/Lec18_Files/current_alumni_sessions.php
// echo $_SERVER['PHP_SELF'], "
";
# The following prints the same as the one above
// echo $_SERVER['REQUEST_URI'], "
";
# The following prints /opt/lampp/htdocs
// echo $_SERVER['DOCUMENT_ROOT'], "
";
# The following prints www.cs.fredonia.edu
// echo $_SERVER['SERVER_NAME'], "
";
/* Check if cookies are disabled.*/
if (!isset($_COOKIE["PHPSESSID"]) && !isset($_GET["PHPSESSID"]))
{
$redirect = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$id = strip_tags(SID);
# Don't replace SID by session_id() in the above.
header("Location: ".$redirect."?$id");
# header("Location: ".$redirect."?SID"); # NO
exit;
}
elseif (!isset($_COOKIE["PHPSESSID"]) && isset($_GET["PHPSESSID"]))
{
exit("
You have to enable cookies to log in.
"); }