aktuelle.kurse/old_m133/4_Modulinhalte_und_Uebungen/08-Session-Sicherheit/Cookies Sessions (Wal)/PHP7/15 - cookies/loeschen.php

38 lines
777 B
PHP
Raw Normal View History

2022-02-23 22:44:33 +01:00
<?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>