-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhistoria.php
More file actions
221 lines (177 loc) · 7.53 KB
/
historia.php
File metadata and controls
221 lines (177 loc) · 7.53 KB
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?php
//--- dolaczenie plikow
if(file_exists('config.php')) {
include('config.php');
include('inc/baza_polacz.php');
}
include('funkcje/funkcje.php');
include("inc/sesje.php");
//######## STRONNICOWANIE
function wskaznik($strona, $liczba_stron)
{
$wynik = "<span class='text-muted small'><center>strona $strona/$liczba_stron</center></span><nav aria-label='Page navigation example'><ul class='pagination justify-content-center'>";
if ($strona > 1) {
$wynik .= " <li class='page-item'><a class='page-link' href='historia.php?strona=1'><i class='material-icons'>first_page</i></a></li> ";
} else {
$wynik .= " <li class='page-item disabled'><a class='page-link' href='' tabindex='-1' aria-disabled='true'><i class='material-icons'>first_page</i></a></li> ";
}
$poprzednia = $strona - 1;
if ($poprzednia > 0) {
$wynik .= " <li class='page-item'><a class='page-link' href='historia.php?strona=$poprzednia'><i class='material-icons'>navigate_before</i></a></li> ";
} else {
$wynik .= " <li class='page-item disabled'><a class='page-link' href=''><i class='material-icons'>navigate_before</i></a></li> ";
}
$nastepna = $strona + 1;
if ($nastepna <= $liczba_stron) {
$wynik .= " <li class='page-item'><a class='page-link' href='historia.php?strona=$nastepna'><i class='material-icons'>navigate_next</i></a></li> ";
} else {
$wynik .= " <li class='page-item disabled'><a class='page-link' href=''><i class='material-icons'>navigate_next</i></a></li> ";
}
if ($strona < $liczba_stron) {
$wynik .= " <li class='page-item'><a class='page-link' href='historia.php?strona=$liczba_stron'><i class='material-icons'>last_page</i></a></li> ";
} else {
$wynik .= " <li class='page-item disabled'><a class='page-link'><i class='material-icons'>last_page</i></a></li> ";
}
$wynik .= "</ul></nav>";
return $wynik;
}
?>
<!doctype html>
<html lang="pl">
<head>
<?php
//--- dolaczenie plikow
include('inc/head.php');
?>
</head>
<body>
<?php
//--- dolaczenie plikow
if(file_exists('config.php')) {
include('inc/menu.php');
include('inc/baner.php');
include('operacje/!_spis.php');
include('inc/pole_alerts.php');
}
?>
<?php
if(file_exists('config.php')) {
//zainstalowany
?>
<div class="container tresc">
<?php
if(isset($_SESSION['sesja_uzyt']['zalogowany'])){
?>
<div class="page-header">
<h1>Historia <span></span></h1>
</div>
<div class="table-responsive">
<table class="table table-striped table-hover small table-sm">
<tr>
<th>data</th> <th>nr.ip</th> <th>podstrona</th> <th>system</th> <th>przeglądarka</th> <th>color</th> <th>ekran</th> <th>język</th> <th>user agent</th>
</tr>
<?php
//-------------------------------------------------------------------
//STRONNICOWANIE
$p = array(); //zainiciowanie tablicy $p
$stmt = $db->query("SELECT * FROM historia");
while($wiersz = $stmt->fetch(PDO::FETCH_ASSOC)){$id_art = $wiersz['id']; $p[]=$id_art;}
$liczba_rekordow = count($p); //liczba wszystkich rekordow
$rekordow_na_stronie = 30; //liczba rekordow na stronie
$liczba_stron = (int) (($liczba_rekordow + $rekordow_na_stronie - 1) / $rekordow_na_stronie);
if (isset($_GET['strona']) && str_ievpifr($_GET['strona'], 1, $liczba_stron)) {
$strona = $_GET['strona'];
}else{
$strona = 1;
}
$start = ($strona - 1) * $rekordow_na_stronie;
$stmt = $db->query("SELECT * FROM `historia` ORDER BY `historia`.`id` DESC LIMIT $start ,$rekordow_na_stronie");
while($wiersz = $stmt->fetch(PDO::FETCH_ASSOC)){
$data_utw = $wiersz['data_utw']; $data_utw = date('d-m-Y, H:i:s', $data_utw);
$ip = $wiersz['ip'];
$podstrona = $wiersz['podstrona'];
$system = $wiersz['system'];
$przegladarki = $wiersz['przegladarki'];
$color = $wiersz['color'];
$ekran = $wiersz['ekran'];
$jezyk = $wiersz['jezyk'];
$ciaguser = $wiersz['ciaguser'];
echo
<tr>
<td class="text-muted small">'.$data_utw.'</td> <td class="text-muted small">'.$ip.'</td> <td class="text-muted small">'.$podstrona.'</td> <td class="text-muted small">'.$system.'</td> <td class="text-muted small">'.$przegladarki.'</td> <td class="text-muted small">'.$color.' bit.</td> <td class="text-muted small">'.$ekran.'</td> <td class="text-muted small">'.$jezyk.'</td> <td class="text-muted small">'.$ciaguser.'</td>
</tr>';
}
?>
</table>
</div>
<?php
echo wskaznik($strona, $liczba_stron); //stronnicowanie
?>
<form action="" method="post">
<fieldset class="border p-2">
<legend class="w-auto">Usuń Historię</legend>
<button type="button" class="btn btn-danger btn-lg btn-block my-4" data-toggle="modal" data-target="#okienko_usun"><i class="material-icons">delete_forever</i> Usuń Historię <i class="material-icons">delete_forever</i></button>
</fieldset>
</form>
<!-- Modal -->
<div class="modal fade" id="okienko_usun">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Czy chcesz usunąć całą Historię ?</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<form action="historia.php" method="post" class="form-horizontal">
<fieldset class="border p-2">
<legend class="w-auto">Pomoc</legend>
<p class="text-muted small">Operacją tą stosuje się gdy jest już bardzo dużo rekordów w Historii. Po uruchomieniu tej operacji, przybywa nam również wolnego miejsca w Bazie Danych. Po tym zabiegu cała Historia zostanie bezpowrotnie usunięta.</p>
</fieldset>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<input type="hidden" value="Historia" name="tabelka">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Nie</button>
<button type="submit" class="btn btn-success" name="wyslij_7" title="tak usuń">Tak</button>
</form>
</div>
</div>
</div>
</div>
<hr />
<p>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
<i class="material-icons">live_help</i> Historia
</button>
</p>
<div class="collapse" id="collapseExample">
<div class="card card-body">
Dane zawarte w powyższej tabeli pokazują wszystkie wejścia na stronę monitorowaną ze szczegółami takimi jak: data, nr.ip, podstrona, system, przeglądarka, color, ekran, język i ciąg user agent. User Agent według Wikipedi jest to aplikacja kliencka, nagłówek zawierający tzw. user agent string (UAString) służy serwisom internetowym (np. aplikacji napisanej w języku PHP) do rozpoznania typu programu klienckiego, również do budowania statystyk odwiedzin witryn WWW przez różne przeglądarki bądź roboty. Dane zapisywane są od góry tabeli, czyli najnowsza historia znajduje się na górze.
</div>
</div>
</div>
<?php
}else{
include('inc/form_logowania.php');
}
?>
</div>
<?php
if(isset($_SESSION['sesja_uzyt']['zalogowany'])){
include('inc/zalogowany_jako.php');
}
}else{
//instalacja
include('instalacja/index.php');
}
?>
<?php
if(file_exists('config.php')) {
include('inc/stopka.php');
}
include('inc/stopka_bootstrap.php');
?>
</body>
</html>