bigly-chat/docs/meta.php

71 lines
1.5 KiB
PHP
Raw Normal View History

2025-01-24 14:12:53 -05:00
<?php
2025-02-05 01:27:45 -05:00
require(__DIR__ . "/../libs/page.php");
require(__DIR__ . "/../libs/form.php");
require(__DIR__ . "/../libs/comment.php");
$roles = array();
page_header();
// this is a mess
function get_handler()
{
global $db;
global $username;
global $user;
global $bio;
global $followers;
global $following;
global $roles;
// there is 100% a better way to do this but i need to test
if (!array_key_exists('id', $_GET)) {
die();
}
$user = $_GET['id'];
if (array_key_exists('type', $_GET)) {
$type = $_GET['type'];
if ($type == 'follow') {
follow();
} elseif ($type == 'settings') {
settings();
2025-01-24 14:12:53 -05:00
}
}
2025-02-05 01:27:45 -05:00
$stmt = $db->prepare("SELECT * FROM main.user WHERE UPPER(username) LIKE UPPER(?)"); //weirdly, this requires a schema name
$stmt->execute([$user]);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt = $db->prepare("SELECT * FROM main.follow WHERE target = ?");
$stmt->execute([$user]);
$following = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ?");
$stmt->execute([$user]);
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
}
get_handler();
2025-01-24 14:12:53 -05:00
?>
<h2>Following</h2>
2025-02-05 01:27:45 -05:00
<?php
foreach ($following as $user) {
2025-02-07 11:37:04 -05:00
user_block($user['username'], false, false);
2025-02-05 01:27:45 -05:00
}
2025-01-24 14:12:53 -05:00
?>
<h2>Followers</h2>
2025-02-05 01:27:45 -05:00
<?php
foreach ($followers as $user) {
2025-02-07 11:37:04 -05:00
user_block($user['target'], false, false);
2025-02-05 01:27:45 -05:00
}
page_footer();
2025-01-24 14:12:53 -05:00
?>