summaryrefslogtreecommitdiff
path: root/src/emotes
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-04-20 16:06:19 +0500
committerilotterytea <iltsu@alright.party>2025-04-20 16:06:19 +0500
commit5fc857449011f76ed7677aad40576790310d23e1 (patch)
treea8bbff085c1cd83d5070c1bf4c013e79cfe8f938 /src/emotes
parent10cde47798f2a7b10a84a22f53aeddab1ceea720 (diff)
feat: moved from SQLite to MySQL
Diffstat (limited to 'src/emotes')
-rw-r--r--src/emotes/single_page.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/emotes/single_page.php b/src/emotes/single_page.php
index fb87789..900003c 100644
--- a/src/emotes/single_page.php
+++ b/src/emotes/single_page.php
@@ -1,3 +1,6 @@
+<?php
+include_once "../../src/config.php";
+?>
<html>
<head>
@@ -76,17 +79,16 @@
$link = "#";
if ($emote->get_uploaded_by()) {
- $db = new SQLite3("../../database.db");
- $stmt = $db->prepare("SELECT username FROM users WHERE id = :id");
- $stmt->bindValue(":id", $emote->get_uploaded_by());
- $results = $stmt->execute();
+ $db = new PDO(DB_URL, DB_USER, DB_PASS);
+ $stmt = $db->prepare("SELECT username FROM users WHERE id = ?");
+ $stmt->execute([$emote->get_uploaded_by()]);
- if ($row = $results->fetchArray()) {
+ if ($row = $stmt->fetch()) {
$username = $row["username"];
$link = "/users/" . $emote->get_uploaded_by();
}
- $db->close();
+ $db = null;
}
echo "<a href=\"$link\">";