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_cook5.php
204 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?php
error_reporting(-1); // Report all type of errors
ini_set('display_errors', 1); // Display all errors
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
session_start();
?>
<!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="">
<?php if(count($_POST) == 0) { ?>
<label for="name">Namn</label><br>
<input type="text" name="name"> <br>
<label for="epost">Email</label><br>
<input type="email" name="epost"> <br>
<label for="pw">Lösenord</label><br>
<input type="password" name="pw"> <br>
<input type="submit" value="Skicka">
<?php }
if(isset($_POST["name"])) {
$_SESSION["name"] = $_POST["name"];
$_SESSION["epost"] = $_POST["epost"];
$_SESSION["pw"] = $_POST["pw"];
if($_POST["pw"] !== "FCB"){
echo "Fel lösenord! <br>";
echo "<input type=\"submit\" value=\"Gå tillbaka\">";
}
else {
?>
<fieldset>
<legend>Vem är bästa fotbollspelaren någonsin?</legend>
<div>
<input type="radio" name="fraga1" value="Messi" id="">
<label for="Messi">Lionel Andrés Messi</label>
</div>
<div>
<input type="radio" name="fraga1" value="Penaldo" id="">
<label for="Penaldo">Cristiano Penaldo</label>
</div>
<div>
<input type="radio" name="fraga1" value="Akinfenwa" id="">
<label for="Akinfenwa">Adebayo Akinfenwa</label>
</div>
<div>
<input type="radio" name="fraga1" value="Lamine" id="">
<label for="Lamine">Lamine Yamal</label>
</div>
<input type="submit" value="Skicka">
</fieldset>
<?php }} if(isset($_POST["fraga1"])) {
$_SESSION["fraga1"] = $_POST["fraga1"];
?>
<fieldset id="fraga2">
<legend>Vilket lag har flest CL-titlar?</legend>
<div>
<input type="radio" name="fraga2" value="FCB" id="">
<label for="FCB">FC Barcelona</label>
</div>
<div>
<input type="radio" name="fraga2" value="Milan" id="">
<label for="Milan">AC Milan</label>
</div>
<div>
<input type="radio" name="fraga2" value="Real" id="">
<label for="Real">Real Madrid</label>
</div>
<div>
<input type="radio" name="fraga2" value="City" id="">
<label for="City">Manchester City</label>
</div>
<input type="submit" value="Skicka">
</fieldset>
<?php } if(isset($_POST["fraga2"])) {
$_SESSION["fraga2"] = $_POST["fraga2"];
?>
<fieldset id="fraga3">
<legend>Vilket lag vann EM 2024?</legend>
<div>
<input type="radio" name="fraga3" value="England" id="">
<label for="England">England</label>
</div>
<div>
<input type="radio" name="fraga3" value="Frankrike" id="">
<label for="Frankrike">Frankrike</label>
</div>
<div>
<input type="radio" name="fraga3" value="Neder" id="">
<label for="Neder">Nederländerna</label>
</div>
<div>
<input type="radio" name="fraga3" value="Spanien" id="">
<label for="Spanien">Spanien</label>
</div>
<input type="submit" value="Skicka">
</fieldset>
<?php }?>
<br>
</form>
<?php
if (isset($_POST["fraga3"])) {
$_SESSION["fraga3"] = $_POST["fraga3"];
$namn = $_SESSION["name"];
$svar1 = $_SESSION["fraga1"];
$svar2 = $_SESSION["fraga2"];
$svar3 = $_SESSION["fraga3"];
$antalRatt = 0;
$fraga1 ="Vem är bästa fotbollspelaren någonsin? <br>";
$option11 = " Lionel Andrés Messi<br>";
$option12 = "Cristiano Penaldo<br>";
$option13 = "Adebayo Akinfenwa<br>";
$option14 = "Lamine Yamal <br> <br>";
$fraga2 ="Vilket lag har flest CL-titlar? <br>";
$option21 = " FC Barcelona<br>";
$option22 = "AC Milan<br>";
$option23 = "Real Madrid<br>";
$option24 = "Manchester City <br><br>";
$fraga3 ="Vilket lag vann EM 2024? <br>";
$option31 = " England<br>";
$option32 = "Frankrike<br>";
$option33 = "Nederländerna<br>";
$option34 = "Spanien <br>";
switch ($svar1) {
case "Messi":
$antalRatt += 1;
$option11 = "<span style=\"color:green\">Lionel Andrés Messi<br></span>";
break;
case "Penaldo":
$option12 = "<span style=\"color:red\">Cristiano Penaldo<br></span>";
break;
case "Akinfenwa":
$option13 = "<span style=\"color:red\">Adebayo Akinfenwa<br></span>";
break;
case "Lamine":
$option14 = "<span style=\"color:red\">Lamine Yamal<br></span>";
break;
}
switch ($svar2) {
case "Real":
$antalRatt += 1;
$option23 = "<span style=\"color:green\">Real Madrid<br></span>";
break;
case "Milan":
$option22 = "<span style=\"color:red\">AC Milan<br></span>";
break;
case "FCB":
$option21 = "<span style=\"color:red\">FC Barcelona<br></span>";
break;
case "City":
$option24 = "<span style=\"color:red\">Manchester City<br><br></span>";
break;
}
switch ($svar3) {
case "Spanien":
$antalRatt += 1;
$option34 = "<span style=\"color:green\">Spanien<br><br></span>";
break;
case "England":
$option31 = "<span style=\"color:red\">England<br></span>";
break;
case "Frankrike":
$option32 = "<span style=\"color:red\">Frankrike<br></span>";
break;
case "Neder":
$option34 = "<span style=\"color:red\">Nederländerna<br></span>";
break;
}
$meddelande = "Hej ". $namn. "! <br>". "Du hade ". $antalRatt. " av 3 rätt <br> <br>"
.$fraga1
.$option11
.$option12
.$option13
.$option14
.$fraga2
.$option21
.$option22
.$option23
.$option24
.$fraga3
.$option31
.$option32
.$option33
.$option34
;
$mottagare=$_SESSION["epost"];
$rubrik="Resultat på Quiz";
$mejlhuvud="From: ".$_SESSION["epost"]." \nReply-To: danieleh@varmdogymnasium.se";
mail($mottagare, $rubrik, $meddelande, $mejlhuvud);
echo "<p>SKICKAT till ".$_SESSION["epost"]."</p>";
echo "<p>================================</p>";
}
?>
</body>
</html>