diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-22 02:56:09 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-22 03:23:46 +0500 |
| commit | df783376d2b3bdd8fe5e0e558fa781f40babd7f3 (patch) | |
| tree | 3cad6b62b81a70e73cc5df60b96740e7cf3ec992 /src | |
| parent | 55c5c9ca935a9077a1fd4003e93a10c5144a6bce (diff) | |
feat: users
Diffstat (limited to 'src')
| -rw-r--r-- | src/emotes/single_page.php | 4 | ||||
| -rw-r--r-- | src/partials.php | 3 | ||||
| -rw-r--r-- | src/user.php | 36 |
3 files changed, 40 insertions, 3 deletions
diff --git a/src/emotes/single_page.php b/src/emotes/single_page.php index 92b4e24..d1fc4e8 100644 --- a/src/emotes/single_page.php +++ b/src/emotes/single_page.php @@ -108,7 +108,7 @@ include_once "../../src/config.php"; if ($row = $stmt->fetch()) { $username = $row["username"]; - $link = "/users/" . $emote->get_uploaded_by(); + $link = "/users.php?id=" . $emote->get_uploaded_by(); } $db = null; @@ -154,7 +154,7 @@ include_once "../../src/config.php"; <div class="items row"> <?php while ($row = $stmt->fetch()) { - echo '<a href="/users/' . $row["id"] . '">' . $row["username"] . '</a>'; + echo '<a href="/users.php?id=' . $row["id"] . '">' . $row["username"] . '</a>'; } ?> </div> diff --git a/src/partials.php b/src/partials.php index 8f2d2ab..0087df4 100644 --- a/src/partials.php +++ b/src/partials.php @@ -9,13 +9,14 @@ function html_navigation_bar() </a> <div class="links"> <a href="/emotes" class="button">Emotes</a> + <a href="/users.php" class="button">Users</a> <a href="/emotes/upload.php" class="button">Upload</a> <a href="/account" class="button">Account</a> </div> <?php if (isset($_SESSION["user_id"])) { echo '' ?> - <a href="/users/<?php echo $_SESSION["user_id"] ?>" class="links" style="margin-left:auto;"> + <a href="/users.php?id=<?php echo $_SESSION["user_id"] ?>" class="links" style="margin-left:auto;"> Signed in as <?php echo $_SESSION["user_name"] ?> <img src="/static/userdata/avatars/<?php echo $_SESSION["user_id"] ?>" width="24" height="24" /> </a> diff --git a/src/user.php b/src/user.php new file mode 100644 index 0000000..c09c5d5 --- /dev/null +++ b/src/user.php @@ -0,0 +1,36 @@ +<?php +class User +{ + private int $id; + private string $username; + private int $joined_at; + private int $last_active_at; + + function __construct($row) + { + $this->id = $row["id"]; + $this->username = $row["username"]; + $this->joined_at = strtotime($row["joined_at"]); + $this->last_active_at = strtotime($row["last_active_at"]); + } + + function id() + { + return $this->id; + } + + function username() + { + return $this->username; + } + + function joined_at() + { + return $this->joined_at; + } + + function last_active_at() + { + return $this->last_active_at; + } +}
\ No newline at end of file |
