cool changes

This commit is contained in:
ui0ppk 2023-02-13 00:29:25 +02:00
parent 66d48c1553
commit cd3e35c243
2 changed files with 39 additions and 6 deletions

View File

@ -34,10 +34,20 @@ class PartyStarter {
unset($_SESSION["user"]);
}
$query = $con->prepare('SELECT * FROM users WHERE id=:id');
$query = $con->prepare('SELECT * FROM friends WHERE user=:id AND state="pending"');
$query->bindParam(':id', $_SESSION['user'], PDO::PARAM_INT);
$query->execute();
if($query->fetchColumn() >= 1) {
$friendnotif = '<span class="position-absolute bottom-0 start-0 badge border border-light rounded-circle bg-danger p-2"><span class="visually-hidden">friend request</span></span>';
} else {
$friendnotif = null;
}
echo $query->fetchColumn();
$query = $con->prepare('SELECT * FROM users WHERE id=:id');
$query->bindParam(':id', $_SESSION['user'], PDO::PARAM_INT);
$query->execute();
// if admin
if($query->fetch(PDO::FETCH_ASSOC)["admin"] >= 1) {
$adminTab = ' <li class="nav-item nav-animated">
@ -95,13 +105,13 @@ class PartyStarter {
<li class="nav-item dropdown">
<button class="nav-link border-0 text-dark dropdown-toggle bg-transparent" data-bs-toggle="dropdown" aria-expanded="false">
<img height=32 width=32 class="rounded-5 position-relative" src="/assets/renders/user/headshot?userId='.(int)htmlspecialchars($_SESSION['user']).'">
<span class="position-absolute bottom-0 start-0 badge border border-light rounded-circle bg-danger p-2"><span class="visually-hidden">friend request</span></span>
'.$friendnotif.'
</img>
</button>
<ul class="dropdown-menu dropdown-menu-lg-end anim-dropdown" style="z-index: 3;">
<li><a class="nav-link ms-2" href="/user"><span class="bi bi-person-circle"></span> Profile</a></li>
<li><a class="nav-link ms-2" href="/settings"><span class="bi bi-gear"></span> Settings</a></li>
<li><a class="nav-link ms-2" href="/friends#pills-profile-tab"><span class="bi bi-gear"></span> Friend requests</a></li>
<li><a class="nav-link ms-2" href="/friends"><span class="bi bi-person"></span> Friend requests</a></li>
<li><a class="nav-link ms-2" href="/logout"><span class="bi bi-box-arrow-right"></span> Logout</a></li>
</ul>
</li>';

View File

@ -24,17 +24,40 @@ $getitstarted->header();
<main class="container text-white" style="width: 100%;">
<br>
<h2>Friends</h2>
<ul class="nav nav-pills mb-3 nav-fill" id="pills-tab" role="tablist">
<div class="nav nav-tabs mb-3 nav-fill" id="pills-tab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" data-bs-target="#pills-home" type="button" role="tab" aria-controls="pills-home" aria-selected="true">Friends</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" data-bs-target="#pills-profile" type="button" role="tab" aria-controls="pills-profile" aria-selected="false">Friend requests</button>
</li>
</ul>
</div>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab" tabindex="0">...</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab" tabindex="0">...</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab" tabindex="0">
<table class="table table-dark table-striped border">
<thead>
<tr class="border">
<th scope="col" class="border">#</th>
<th scope="col" class="border">Friend</th>
<th scope="col" class="text-end border">Action</th>
</tr>
</thead>
<tbody>
<tr style="vertical-align: middle;">
<th scope="row">1</th>
<td><img class="rounded-5" height=32 width=32 src="assets/renders/user/headshot?userId=1">qzip</td>
<td class="text-end">
<div class="btn-group" role="group" aria-label="Basic example">
<a class="btn btn-danger">Deny</a><a class="btn btn-success">Approve</a></td>
</div>
</tr>
</tbody>
</table>
</div>
</div>
</main>