-
Notifications
You must be signed in to change notification settings - Fork 0
/
cegesautok.php
102 lines (98 loc) · 3.14 KB
/
cegesautok.php
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
<?php
session_start();
//$viapanServer = mysqli_connect("localhost","root","ASDW1298","viapan");
include "functions.php";
include 'css/headerAdmin.php';
$userName = $_SESSION['userName'];
if (!isset($userName)) {
?>
<script type="text/javascript">
window.location="index.php";
</script>
<?php } ?>
<body>
<div class="container jumbotron">
<?php
$userId = $_SESSION['userName'];
$userAuth = $_SESSION['auth'];
//$viapanServer = mysqli_connect("localhost","root","ASDW1298","viapan");
$ceges = "ceges";
$query = "SELECT * FROM autok WHERE tulaj = '$ceges'";
$userSet = mysqli_query($viapanServer, $query);
?>
<form action="ujauto.php" method="post">
<h2>Céges autók listája
<?php if ($auth=="superuser") {
?>
<button class="btn btn-group-lg btn-success" type="submit">Autók kezelése</button>
<?php } ?>
<p></p>
</h2>
</div>
</form>
<div class="container">
<div class="jumotron">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Rendszám</th>
<th>Cég</th>
<th>Márka</th>
<th>Tipus</th>
<th>Üzemanyag</th>
<th>Fogasztás (l/100km)</th>
<th>Bérleti szerződés száma</th>
<th>Engedélyek</th>
</tr>
</thead>
<tbody>
<script src="https://code.jquery.com/jquery-1.9.1.min.js" charset="utf-8"></script>
<script type="text/javascript">
$.noConflict();
$( document ).ready( function() {
$('[data-toggle="popover"]').popover()
})
</script>
<?php
// itt a céget kiválasztjuk
$ceges = "ceges";
$query = "SELECT * FROM autok WHERE tulaj = '$ceges'";
$autokSet = mysqli_query($viapanServer, $query);
while ($autok = mysqli_fetch_assoc($autokSet)) {
$rendszam = $autok['rendszam'];
$ceg = $autok['ceg'];
$marka = $autok['marka'];
$tipus = $autok['tipus'];
$uzemanyag = $autok['uzemanyag'];
$fogyasztas = $autok['fogyasztas'];
$berletszam = $autok['berletszam'];
echo "<tr><td>$rendszam</td>";
echo "<td>$ceg</td>";
echo "<td>$marka</td>";
echo "<td>$tipus</td>";
echo "<td>$uzemanyag</td>";
echo "<td>$fogyasztas</td>";
echo "<td>$berletszam</td>";
if ($auth == "superuser" || $auth == "admin") {
$userList = "";
$userQ = "SELECT * FROM hozzarendel WHERE rendszam = '{$rendszam}'";
$userSet = mysqli_query($viapanServer, $userQ);
while ($felhasznalok = mysqli_fetch_assoc($userSet)) {
$userSelected = $felhasznalok['felhasznalo'];
$userList = $userList . $userSelected . ", ";
}
if ($userList == "") {
$userList = "Jelenleg nincs az autóhoz rendelve egy felhasználó sem.";
}
echo "<td><button class='btn btn-success' data-toggle='popover' data-trigger='focus' data-placement='top' title='Felhasználók listája' data-content='$userList'>Ki vezetheti?</button></td>";
}
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</body>
</html>