aktuelle.kurse/m133/4_Modulinhalte_und_Uebungen/15-cookies/loeschen.php
Harald G. Mueller 28ff49e098 muh
2023-06-29 07:50:41 +02:00

38 lines
777 B
PHP

<?php
if (isset($_GET["kill"])) {
setcookie($_GET["kill"], "", 0, "/");
}
?>
<html>
<head>
<title>Cookies</title>
<?php
if (isset($_GET["kill"])) {
echo("<meta http-equiv=\"refresh\" " .
"content=\"0;url=" .
htmlspecialchars($_SERVER["PHP_SELF"]) .
"\">");
}
?>
</head>
<body>
<table>
<tr><th>Name</th><th>Wert</th>
<th>L&ouml;schen?</th></tr>
<?php
foreach (array_keys($_COOKIE) as $name) {
echo("<tr><td>" . htmlspecialchars($name) .
"</td>");
echo("<td>" .
htmlspecialchars($_COOKIE[$name]) .
"</td>");
echo("<td><a href=\"" .
htmlspecialchars($_SERVER["PHP_SELF"]) .
"?kill=" . urlencode($name) .
"\">Ja</a></td></tr>");
}
?>
</table>
</body>
</html>