cookie stuff
This commit is contained in:
parent
136a2dbe10
commit
ea20a64098
37
docroot/html/cookies.php
Normal file
37
docroot/html/cookies.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
require_once("_head.php");
|
||||
|
||||
mkheader("cookies!", "#eaa");
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- ======================================================= -->
|
||||
<pre><?php
|
||||
|
||||
/*
|
||||
print("All current cookies:\n");
|
||||
print_r($_COOKIE);
|
||||
*/
|
||||
|
||||
$testcookie = $_COOKIE['test'];
|
||||
|
||||
if ($testcookie) {
|
||||
$array = explode("-", $testcookie); //retrieve contents of cookie
|
||||
print("PHP stands for '{$array[0]} {$array[1]} {$array[2]}'\n"); //display the content
|
||||
|
||||
print("Removing 'test' cookie");
|
||||
setcookie("test", false);
|
||||
|
||||
} else {
|
||||
setcookie("test", "PHP-Hypertext-Preprocessor");
|
||||
print("Set 'test' cookie");
|
||||
}
|
||||
|
||||
?></pre>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user