summaryrefslogtreecommitdiff
path: root/viewuser.php
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-06-05 11:18:10 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-06-05 11:18:10 -0600
commit24efe49bc2b545e3a3e46d7d6f2bd1166163e52b (patch)
treec1852447d06c062052def6fc89be2e2dece17c78 /viewuser.php
parent45acfc48b3dd80b945a1501edea9ad4faa700c0f (diff)
Move object related functions into their classes.
Some of the pages are still broken from this commit, but I plan to either rewrite or ignore them.
Diffstat (limited to 'viewuser.php')
-rw-r--r--viewuser.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/viewuser.php b/viewuser.php
index 45f557a..de40d6f 100644
--- a/viewuser.php
+++ b/viewuser.php
@@ -3,22 +3,29 @@ include_once './includes/model/User.php';
session_start();
-$current = new User();
+if (!isset($_GET['id']) or !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
+ http_response_code(404);
+ include('includes/templates/404.php');
+ die();
+}
-if (!isset($_GET['id'])) {
-} else {
- $current->get_by_id($_GET['id']);
+$current = new User();
+$current->get_by_id($_GET['id']);
+if (!$current->has_value()) {
+ http_response_code(404);
+ include('includes/templates/404.php');
+ die();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
- <title><?= $current->name; ?>'s Profile - cflip.net forum</title>
- <link rel="stylesheet" href="styles/style.css">
+ <title><?= $current->name; ?>'s Profile - cflip.net forum</title>
+ <link rel="stylesheet" href="styles/style.css">
</head>
<body>
<?php include_once "includes/templates/header.php" ?>
-<h1><?= $current->name; ?></h1>
-member since <?= date('M d, Y', strtotime($current->date)); ?>
+ <h1><?= $current->name; ?></h1>
+ member since <?= date('M d, Y', strtotime($current->date)); ?>
</body>
</html>