bigly-chat/libs/page.php

64 lines
2.1 KiB
PHP
Raw Normal View History

2024-11-26 11:38:28 -05:00
<?php
2025-02-05 01:27:45 -05:00
require(__DIR__ . "/auth.php");
global $username;
function page_header()
{
global $db;
2024-11-26 23:37:16 -05:00
global $username;
2025-02-05 01:27:45 -05:00
$stmt = $db->prepare("SELECT * FROM comment WHERE targetType = ? AND targetId = ? ORDER BY date DESC");
$stmt->execute([
2025-02-07 11:37:04 -05:00
"notification",
$username,
2025-02-05 01:27:45 -05:00
]);
2025-01-20 16:50:22 -05:00
2025-02-05 01:27:45 -05:00
$posts2 = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$edge = count($posts2);
?>
<!DOCTYPE html>
<html>
<head>
<title>BiglyChat</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1">
<link rel="icon" href="/img/bgc.svg">
2025-01-28 17:09:23 -05:00
<link rel="stylesheet" href="/css/main.css">
2025-02-05 01:27:45 -05:00
</head>
<body>
<div class="header">
<a href="/"><img class="header-img header-link" src="/img/bgc.svg">BiglyChat</a>
2025-02-07 11:37:04 -05:00
<?php if (isset($username)) { ?>
2025-02-05 01:27:45 -05:00
<a href="/user.php?id=<?php echo $username ?>"><img class="header-img header-link" src="/pfp/<?php echo $username ?>.png">Wall</a>
<a href="/notif.php"> <img class="header-img header-link" src="/img/mail.svg"><span>Mail<sub> <?php echo $edge?></sub></span></a>
<a href="/stats.php?username=<?php echo $username ?>"><img class="header-img header-link" src="/img/home.svg">Users</a>
2025-02-07 11:37:04 -05:00
<a href="/logout.php"><img class="header-img header-link" src="/img/logout.svg">Leave</a>
2025-02-05 01:27:45 -05:00
<?php } else { ?>
<a href="/login.php"><img class="header-img header-link" src="/img/home.svg">Join</a>
2025-02-07 11:37:04 -05:00
<a href="/stats.php"><img class="header-img header-link" src="/img/home.svg">Users</a>
<?php }
2025-02-05 01:27:45 -05:00
?>
</div>
2025-02-07 11:37:04 -05:00
<?php }
2025-02-05 01:27:45 -05:00
function page_footer()
{ ?>
2025-02-07 11:37:04 -05:00
</body>
</html>
<?php }
function user_block($usern, $meta, $tag)
{
?>
<div class='comment'>
<div class="avatar">
<img src="/pfp/<?php echo $usern ?>.png" class="avatar-img">
<div>
<div><b>
<a class="link" href="/user.php?id=<?php echo $usern ?>">
<?php echo $usern ?>
</a>
</b>
</div>
</div>
</div>
<?php echo (is_null($meta) || !$meta) ? '' : "<b>$tag</b>: $meta"; ?>
</div>
<?php }
?>