



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























server Clien t Cookie Session
setcookie (name,value,expire,path,domain,secure) Parameter Description name (Required). Specifies the name of the cookie value (Required). Specifies the value of the cookie expire (Optional). Specifies when the cookie expires. e.g. time()+36002430** will set the cookie to expire in 30 days. If this parameter is not set, the cookie will expire at the end of the session (when the browser closes). path (Optional). Specifies the server path of the cookie. If set to " / ", the cookie will be available within the entire domain. If set to " /phptest/ ", the cookie will only be available within the test directory and all sub-directories of phptest. The default value is the current directory that the cookie is being set in. domain (Optional). Specifies the domain name of the cookie. To make the cookie available on all subdomains of example.com then you'd set it to ".example.com". Setting it to www.example.com will make the cookie only available in the www subdomain secure (Optional). Specifies whether or not the cookie should only be transmitted over a secure HTTPS connection. TRUE indicates that the cookie will only be set if a secure connection exists. Default is FALSE.
GET /.html HTTP/1. Host: it026954.domain GET /.html HTTP/1. Host: it026945.domain Cookie: name=value Accept: /
Content-type: text/html Set-Cookie: name=value (content of page) Client (e.g. Firefox) it
Setcookie (name,value,expire, path, Setcookie (name,value,expire, path, domain,domain, secure)secure) e.g.
PHP Script using Cookies
"; ?>
Gets an error!: Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/TESTandre/159339/PHP/cookie_with_headers.php:9) in /var/www/html/TESTandre/159339/PHP/cookie_with_headers.php on line 11 (adapted from Stobart & Parsons (2008))
$strInfo
"; echo "Your IP address is: $arrListOfStrings[0]
"; echo "Client Browser is: $arrListOfStrings[1]
"; echo "Your OS is: $arrListOfStrings[2]
"; ?>