summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-30 01:01:31 +0500
committerilotterytea <iltsu@alright.party>2025-04-30 01:01:31 +0500
commitea85d9383460d1957158b023b3b3647d3026687f (patch)
treecec7abc2dd3c7841cc5266fc1aef8558352fbd74 /src
parent8c148952a95ee756038bc0e7afbf52f63249227f (diff)
feat: random emote
Diffstat (limited to 'src')
-rw-r--r--src/emote.php24
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