I'm having a problem with a script found on page 289 of Gareth Downes-Powell's book, "Dreamweaver MX: Advanced PHP Web Development." The script is part of a process that allows users to select their preference for a stylesheet.
The PHP version being run is 4.3 and global variables is off. Does the script, as written, need global variables on? Is it possible the problem has to do with $_SERVER['HTTP_REFERER']? I recall seeing somewhere that there could be problems when using it with GET.
Anyone know of an alternate way to allow users to select their favorite stylesheet?
When the script runs it chokes on this line:
(Of course my_domain is replaced with the real domain.)
setcookie("first_name", $first_name, mktime(21,00,0,12,31,2014,"/", ".my_domain.com", 0);
The error message reads:
Parse error: parse error in /public_html/change_style.php on line 11
THIS IS THE COMPLETE CODE:
<?php
$style_selection=strip_tags($_GET['style_selection']);
$first_name=strip_tags($_GET["first_name"]);
if($style_selection == "" || $first_name == "")
{
header("Location: $_SERVER['HTTP_REFERER']");
}
setcookie("first_name", $first_name, mktime(21,00,0,12,31,2014,"/", ".my_domain.com", 0);
setcookie("style_selection", style_selection, mktime(21,00,0,12,31,2014,"/", ".my_domain.com", 0);
header("Location: $_SERVER[HTTP_REFERER]");
?>