Show sourcecode
The following files exists in this folder. Click to view.
dininloggningssida.php
index.html
ovn_cook1.php
ovn_cook2.php
ovn_cook3.php
ovn_cook4.php
ovn_cook5.php
ovn_cook4.php
64 lines UTF-8 Windows (CRLF)
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form method="post" action="">
<input type="number" name="tal"><br>
<br>
<input type="submit" name="Submit">
</form>
<form action="" method="post">
<input type="hidden" name="destroy" value="1">
<input type="submit" name="Destroy" value="Destroy">
</form>
<?php
session_start();
if (isset($_POST['destroy'])) {
$_SESSION = array();
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(
session_name(),
'',
time() - 42000,
$params["path"],
$params["domain"],
$params["secure"],
$params["httponly"]
);
}
session_destroy();
}
if (isset($_SESSION['visningar'])) {
$_SESSION['visningar']++;
} else {
$_SESSION['visningar'] = 1;
}
if (isset($_POST['tal']) && !empty($_POST['tal'])) {
$talsumma = 0;
$_SESSION['allanummer'][] = $_POST['tal'];
echo "Tal: <br>";
for ($i = 0; $i < count($_SESSION['allanummer']); $i++) {
echo $_SESSION['allanummer'][$i] . "<br>";
$talsumma += $_SESSION['allanummer'][$i];
}
echo "<br> Medelvärde: ". $talsumma/$_SESSION['visningar'];
}
?>
</body>
</html>