This repository was archived by the owner on May 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgangs.php
120 lines (110 loc) · 4.09 KB
/
gangs.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
// create a database connection, using the constants from config/db.php (which we loaded in index.php)
$db_connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$page_rows = results_per_page;
// change character set to utf8 and check it
if (!$db_connection->set_charset("utf8")) {
$db_connection->errors[] = $db_connection->error;
}
?>
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
<?php echo $lang['gangs']; ?>
<small><?php echo " " . $lang['overview']; ?></small>
</h1>
</div>
</div>
<!-- /.row -->
<div class="col-md-12">
<div class="content-panel">
<table class="table table-striped table-advance table-hover">
<h4>
<i class="fa fa-sitemap fa-fw"></i>
<?php echo " " . $lang['gangs']; ?>
<div class="col-lg-4 pull-right">
<form style="float:right;" method='post' action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"
name='searchPlayer'>
<input id='searchText' type='text' name='searchText'>
<input class='btn btn-sm btn-primary' type='submit' name='pid'
value='<?php echo $lang['search'] . " " . $lang['PID']; ?>'>
<input class='btn btn-sm btn-primary' type='submit' name='name'
value='<?php echo $lang['search'] . " " . $lang['name']; ?>'>
</form>
</div>
</h4>
<hr>
<thead>
<tr>
<th><i class="fa fa-eye"><?php echo " " .$lang['id']; ?></th>
<th><i class="fa fa-user"><?php echo " " .$lang['gang'] . " " . $lang['name']; ?></th>
<th><i class="fa fa-user"><?php echo " " .$lang['owner']; ?></th>
<th><i class="fa fa-bank"><?php echo " " .$lang['bank']; ?></th>
<th><i class="fa fa-user"><?php echo " " .$lang['maxMembers']; ?></th>
<th><i class="fa fa-user"><?php echo " " .$lang['active']; ?></th>
<th><i class="fa fa-pencil"><?php echo " " . $lang['edit']; ?></th>
</tr>
</thead>
<tbody>
<?php
if (!$db_connection->connect_errno) {
if (isset($_GET["page"])) {
$page = $_GET["page"];
}else {
$page=1;
}
$start_from = ($page-1) * $page_rows;
$max = 'LIMIT ' . $start_from . ',' . $page_rows;
if (isset($_POST['searchText'])) {
$searchText = $_POST['searchText'];
if (isset($_POST['pid'])) {
$sql = "SELECT * FROM `gangs` WHERE `owner` LIKE '%" . $searchText . "%' " . $max . " ;";
} else {
$sql = "SELECT * FROM `gangs` WHERE `name` LIKE '%" . $searchText . "%' " . $max . " ;";
}
} else {
$sql = "SELECT * FROM `gangs` " . $max . " ;";
}
$result_of_query = $db_connection->query($sql);
while ($row = mysqli_fetch_assoc($result_of_query)) {
echo "<tr>";
echo "<td>" . $row["id"] . "</td>";
echo "<td>" . $row["name"] . "</td>";
echo "<td>" . nameID($row["owner"]) . "</td>";
echo "<td>" . $row["bank"] . "</td>";
echo "<td>" . $row["maxmembers"] . "</td>";
echo "<td>" . yesNo($row["active"],$lang) . "</td>";
echo "<td><a class='btn btn-primary btn-xs' href='editGang.php?ID=".$row["id"]."'>";
echo "<i class='fa fa-pencil'></i></a></td>";
echo "</tr>";
};
echo "</tbody></table>";
$sql = "SELECT * FROM `gangs`";
$result_of_query = $db_connection->query($sql);
$total_records = mysqli_num_rows($result_of_query);
$total_pages = ceil($total_records / $page_rows);
echo "<center><a class='btn btn-primary' href='gangs.php?page=1'>".$lang['first']."</a> ";
?>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<?php echo $lang['page'] . " " ?><span class="caret"></span>
</button>
<ul class="dropdown-menu scrollable-menu" role="menu">
<?php
for ($i=1; $i<=$total_pages; $i++) {
?>
<li><?php echo "<a href='gangs.php?page=".$i."'>".$i."</a> "; ?></li>
<?php }; ?>
</ul>
</div>
<?php echo "<a class='btn btn-primary' href='gangs.php?page=".$total_pages."'>".$lang['last']."</a></center>";
} else {
$this->errors[] = "Database connection problem.";
}
?>
</tbody>
<br>
</table>
</div>
</div>