-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
92 lines (76 loc) · 3.49 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
if(isset($_POST['invia']))
{
$name = $_REQUEST['nome'];
$value = $_REQUEST['valore'];
$date = strtotime($_REQUEST['data']);
setcookie($name, $value, $date, "/");
header("Location: index.php");
}
else if(isset($_POST['elimina']))
{
foreach ($_COOKIE as $chiave => $valore)
if(isset($_REQUEST[$chiave]))
setcookie($chiave, "", null, "/");
header("Location: index.php");
}
?>
<html>
<head>
<title>
Cookies
</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="table-responsive">
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
<div class="container">
<div class="row">
<div class="jumbotron text-center"><h2>Cookies</h2></div>
</div>
<div class="row">
<div class="col-sm-6">
<?php
if(count($_COOKIE)>0)
{
foreach ($_COOKIE as $chiave => $valore)
{
echo "<table class='table table-bordered'><tbody><tr><td>" . $chiave . "</td></tr>";
echo "<tr><td>" . $valore . "</td></tr>";
echo "<tr><td>Elimina <input type='checkbox' name=" . $chiave . "></td></tr></tbody></table>";
}
echo "<input type='submit' class='btn btn-default btn-block' name='elimina' value='Rimuovi cookies selezionati'>";
}
?>
</div>
</div>
<br>
<div class="row">
<div class="col-sm-6">
<table class="table table-bordered">
<tbody>
<tr>
<td>Nome: </td>
<td><input type="text" class="form-control" align="center" name="nome"></td>
</tr>
<tr>
<td>Valore: </td>
<td><input type="text" class="form-control" align="center" name="valore"></td>
</tr>
<tr>
<td>Data di scadenza: </td>
<td><input type="date" class="form-control" align="center" name="data"></td>
</tr>
<tr>
<td colspan="2"><input class="btn btn-default btn-block" align="center" type="submit" name="invia" value="Invia"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</form>
</div>
</body>
</html>