/*setcookie("favband", "Lords_Of_Acid", time()+14400,
"/", "mikado.cs.uchicago.edu", 0); */ ?>
CSPP552: Internet Programming: PHP
CSPP552: Internet Programming, PHP part 7
Other web server input in PHP
- Environment variables (like HTTP_COOKIE) are transformed into
regular PHP variables (eg, $HTTP_COOKIE)
- Lists of form input variables are in the $HTTP_GET_VARS and
$HTTP_POST_VARS arrays
Cookies in particular:
- Cookie variables are also transformed into PHP variables
- A list of cookie variables is in the $HTTP_COOKIE_VARS
associative array. From before, we had that `favband' parameter in
the cookie. Well, that'd just be $HTTP_COOKIE_VARS["favband"].
- You can avoid all of that nasty header stuff and set a cookie
with the setcookie function. Example:
setcookie("favband", "Ramones", time()+14400,
"/", "mikado.cs.uchicago.edu", 0);
- However, you MUST set the cookie as the first thing in
the document, before you write any HTML.
Next