-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhelp.php
More file actions
81 lines (77 loc) · 3.44 KB
/
help.php
File metadata and controls
81 lines (77 loc) · 3.44 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
<?php
include("components/head.php");
$_GET["page"]="help";
include("components/header.php");
if (!getSetting("enable_help",true)) {
header("Location: /");
exit;
}
$limit=4;
$countres=$database->query("SELECT count(id) AS id FROM notes WHERE type='help'")??NULL;
$fetchedcount=$countres->fetch_all(MYSQLI_ASSOC);
$total=$fetchedcount[0]['id'];
$pages=ceil($total/$limit);
$page=isset($_GET["pg"])?intval($_GET["pg"]):1;
$page=max(1,min($page,$pages));
$start=($page-1)*$limit;
$result=$database->query("SELECT * FROM notes WHERE type='help' ORDER BY id DESC LIMIT $start, $limit")??NULL;
$prev=$page>1?$page-1:1;
$nxt=$page!=$pages?$page+1:$pages;
if(isset($_GET["id"])){
$id=intval($_GET["id"]);
$data=$database->query("SELECT * FROM notes WHERE type='help' and id='$id'")->fetch_array();
$userdata=getSteamData($data["steamid"]);
?>
<h1 class="font_smol" data-aos="flip-right" data-aos-delay="200"><?=$data["title"]?></h1>
<div data-aos="zoom-in" data-aos-delay="100">
<hr>
<img class="mb-4" src="<?=$data["headimg"]?>">
<?=base64_decode($data["content"])?>
<hr>
<i class="fw-bold d-inline-block" style="float:right;padding-right: 5px;"><a style="text-decoration: none;" class="text-white" href="https://steamcommunity.com/profiles/<?=$userdata["steamid"]?>"><img src="<?php echo $userdata["avatarfull"]?>" style="width:27px;height:27px; border-radius:50%;"> <u><?=$userdata["name"]?></u></a> [<?=date('Y-m-d H:i',$data["created"]);?>]</i>
</div>
<?php
}elseif (mysqli_num_rows($result)) {
while ($row=$result->fetch_assoc()):
?>
<div class="card text-bg-dark mb-3 hoverscale" style="overflow: hidden;" data-aos="zoom-out" data-aos-delay="100">
<div class="image-box">
<a href="?id=<?=$row['id'];?>"><img src="<?=$row["headimg"];?>" class="card-img" style="object-fit: cover; height: 17vh;">
</div>
<h1 class="text-white font_smol position-absolute top-50 start-50 translate-middle" style="width:100%;background-color:rgba(0,0,0,.5);cursor:pointer;"><?=$row["title"];?></h1>
</a>
</div>
<?php endwhile ?>
<?php if ($pages>1){ ?>
<ul class="pagination justify-content-right mt-4" data-aos-offset="0" data-aos="fade-up" data-aos-delay="200">
<?php if($page>4) { ?>
<li class="page-item">
<a class="page-link text-black shadow-none" href="help.php?pg=1">
<span aria-hidden="true">«</span>
</a>
</li>
<?php } ?>
<li class="page-item <?= $page==1?"disabled":""; ?>">
<a class="page-link text-black shadow-none" href="help.php?pg=<?= $prev; ?>">
<span aria-hidden="true">Prev</span>
</a>
</li>
<?php for($i = max(1,$page-3); $i < min($pages+1,$page+3); $i++) { ?>
<li class="page-item"><a class="page-link shadow-none text-black <?= $page==$i?"active":""; ?>" href="help.php?pg=<?= $i; ?>"><?= $i; ?></a></li>
<?php }; ?>
<li class="page-item <?= $page==$pages?"disabled":""; ?>">
<a class="page-link text-black shadow-none" href="help.php?pg=<?= $nxt; ?>">
<span aria-hidden="true">Next</span>
</a>
</li>
<?php if($page<$pages-2) { ?>
<li class="page-item">
<a class="page-link text-black shadow-none" href="help.php?pg=<?=$pages;?>">
<span aria-hidden="true">»</span>
</a>
</li>
<?php } ?>
</ul>
<?php }}else{ ?>
<h4 data-aos="zoom-out" data-aos-delay="200" class="ql-align-center text-danger">so far no any help notes.</h4>
<?php } include("components/footer.php")?>