Show sourcecode
The following files exists in this folder. Click to view.
webbsrvprg/exercises/projekt/incl/
addfilters.php
dbconnection.php
default.php
footer.php
header.php
playertable.php
protected.php
sort.php
stylesheet.css
addfilters.php
67 lines ASCII 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
<?php
$filters = [];
$ownedfilters = [];
if (isset($owned)) {
$ownedfilters = [];
$filters = [];
if (isset($_POST["submit"])) {
if (!empty($_POST["agemax"]) & $_POST["agemin"] <= $_POST["agemax"] & $_POST["agemax"] != 0) {
$ownedfilters['maxage'] = htmlspecialchars($_POST["agemax"], ENT_QUOTES, 'UTF-8');
$ownedfilters['minage'] = htmlspecialchars($_POST["agemin"], ENT_QUOTES, 'UTF-8');
if (empty($ownedfilters['minage'])) {
$ownedfilters['minage'] = 0;
}
}
if (!empty($_POST["ratingmax"]) & $_POST["ratingmin"] <= $_POST["ratingmax"] & $_POST["ratingmax"] != 0) {
$ownedfilters['minrating'] = htmlspecialchars($_POST["ratingmin"], ENT_QUOTES, 'UTF-8');
$ownedfilters['maxrating'] = htmlspecialchars($_POST["ratingmax"], ENT_QUOTES, 'UTF-8');
if (empty($ownedfilters['minrating'])) {
$ownedfilters['minrating'] = 0;
}
}
if (!empty($_POST["nation"])) {
$ownedfilters['nation'] = htmlspecialchars($_POST["nation"], ENT_QUOTES, 'UTF-8');
}
foreach (["position1", "position2", "position3", "position4"] as $pos) {
if (!empty($_POST[$pos])) {
$ownedfilters['position'][] = htmlspecialchars($_POST[$pos], ENT_QUOTES, 'UTF-8');;
}
}
if (!empty($_POST["name"])) {
$ownedfilters['name'] = htmlspecialchars($_POST["name"], ENT_QUOTES, 'UTF-8');
}
}
echo '<script> const ownedfilters = ' . json_encode($ownedfilters) . ';
const filters = 0; </script>';
} else {
if (isset($_POST["submit"])) {
if (!empty($_POST["agemax"]) & $_POST["agemin"] <= $_POST["agemax"] & $_POST["agemax"] != 0) {
$filters['maxage'] = htmlspecialchars($_POST["agemax"], ENT_QUOTES, 'UTF-8');
$filters['minage'] = htmlspecialchars($_POST["agemin"], ENT_QUOTES, 'UTF-8');
if (empty($filters['minage'])) {
$filters['minage'] = 0;
}
}
if (!empty($_POST["ratingmax"]) & $_POST["ratingmin"] <= $_POST["ratingmax"] & $_POST["ratingmax"] != 0) {
$filters['minrating'] = htmlspecialchars($_POST["ratingmin"], ENT_QUOTES, 'UTF-8');
$filters['maxrating'] = htmlspecialchars($_POST["ratingmax"], ENT_QUOTES, 'UTF-8');
if (empty($filters['minrating'])) {
$filters['minrating'] = 0;
}
}
if (!empty($_POST["nation"])) {
$filters['nation'] = htmlspecialchars($_POST["nation"], ENT_QUOTES, 'UTF-8');
}
foreach (["position1", "position2", "position3", "position4"] as $pos) {
if (!empty($_POST[$pos])) {
$filters['position'][] = htmlspecialchars($_POST[$pos], ENT_QUOTES, 'UTF-8');;
}
}
if (!empty($_POST["name"])) {
$filters['name'] = htmlspecialchars($_POST["name"], ENT_QUOTES, 'UTF-8');
}
}
echo '<script> const filters = ' . json_encode($filters) . ';
const ownedfilters = 0 </script>';
}