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
playertable.php
97 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
<section>
<div>
<h2>Filter:</h2>
<form method="post">
<div>
<label for="name">Namn</label>
<br>
<input type="text" name="name">
</div>
<div>
<label for="age">Ålder</label>
<br>
<label for="agemin">Min</label>
<input type="number" name="agemin" min="0" max="99" ><br>
<label for="agemax">Max</label>
<input type="number" name="agemax" min="0" max="99">
</div>
<div>
<br>
<label for="rating">Rating</label>
<br>
<label for="ratingmin">Min</label>
<input type="number" name="ratingmin" min="0" max="99">
<br>
<label for="ratingmax">Max</label>
<input type="number" name="ratingmax" min="0" max="99">
<br>
</div>
<div>
<label for="nation">Land</label> <br>
<select name="nation" id="nation">
<option value=""></option>
<?php
$FilterSort->allCountries();
?>
</select>
</div>
<div>
<label for="position">Position</label>
<br>
<input type="checkbox" name="position1" id="position1" value="ANF">
<label for="position1">ANF</label>
<br>
<input type="checkbox" name="position2" id="position2" value="MF">
<label for="position2">MF</label>
<br>
<input type="checkbox" name="position3" id="position3" value="FÖR">
<label for="position3">FÖR</label>
<br>
<input type="checkbox" name="position4" id="position4" value="MV">
<label for="position4">MV</label>
</div>
<input type="submit" name="submit" value="Filtrera">
</form>
</div>
<br>
<br>
<table id="data">
</table>
</section>
<script>
let currentSort = {
column: 'rating',
order: 'ASC'
};
async function sortplayers(column) {
if (currentSort.column === column) {
currentSort.order = currentSort.order === 'ASC' ? 'DESC' : 'ASC';
//ASC - > DESC, DESC - > ASC
} else {
currentSort.column = column;
currentSort.order = 'ASC';
}
let sorturl = "";
if (filters){
sorturl = 'incl/sort.php?method=' +currentSort.column + '&order=' + currentSort.order + '&filters=' + JSON.stringify(filters);
}
else if (ownedfilters){
sorturl = 'incl/sort.php?method=' +currentSort.column + '&order=' + currentSort.order + '&ownedfilters=' + JSON.stringify(ownedfilters);
}
else {
sorturl = 'incl/sort.php?method=' +currentSort.column + '&order=' + currentSort.order;
}
console.log(sorturl);
let myObject = await fetch(sorturl);
let myText = await myObject.text();
document.getElementById("data").innerHTML = myText;
}
sortplayers('rating');
function playerinfo(str) {
let website = "playerinfo.php?player=" + str;
window.open(website)
}
</script>