diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-30 01:01:31 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-30 01:01:31 +0500 |
| commit | ea85d9383460d1957158b023b3b3647d3026687f (patch) | |
| tree | cec7abc2dd3c7841cc5266fc1aef8558352fbd74 /src | |
| parent | 8c148952a95ee756038bc0e7afbf52f63249227f (diff) | |
feat: random emote
Diffstat (limited to 'src')
| -rw-r--r-- | src/emote.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/emote.php b/src/emote.php index 63d5746..42cd2ac 100644 --- a/src/emote.php +++ b/src/emote.php @@ -62,3 +62,27 @@ class Emote return $this->visibility; } } + +function html_random_emote(PDO &$db) +{ + $stmt = $db->prepare("SELECT id, ext, code FROM emotes WHERE visibility = 1 ORDER BY RAND() LIMIT 1"); + $stmt->execute(); + + if ($row = $stmt->fetch()) { + echo '' + ?> + <section class="box" id="box-random-emote"> + <div class="box navtab"> + <p>Random emote</p> + </div> + <div class="box content center"> + <a href="/emotes?id=<?php echo $row["id"] ?>"> + <img src="/static/userdata/emotes/<?php echo $row["id"] . '/3x.' . $row["ext"] ?>" + alt="<?php echo $row["code"] ?>" width="192"> + </a> + </div> + </section> + <?php + ; + } +}
\ No newline at end of file |
