diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-06-23 15:21:12 -0600 |
---|---|---|
committer | cflip <36554078+cflip@users.noreply.github.com> | 2021-06-23 15:21:12 -0600 |
commit | f5e972c030675f46cda543e13da1b787457e070b (patch) | |
tree | 7c0d2bb4138fe60060ff73b61e15881765ba5412 /viewuser.php | |
parent | fd0c3a283153d6f2d759e5e14888e40e65dc61b7 (diff) |
Add the rest of the changes
Diffstat (limited to 'viewuser.php')
-rwxr-xr-x[-rw-r--r--] | viewuser.php | 86 |
1 files changed, 55 insertions, 31 deletions
diff --git a/viewuser.php b/viewuser.php index de40d6f..20dc55f 100644..100755 --- a/viewuser.php +++ b/viewuser.php @@ -1,31 +1,55 @@ -<?php -include_once './includes/model/User.php'; - -session_start(); - -if (!isset($_GET['id']) or !filter_var($_GET['id'], FILTER_VALIDATE_INT)) { - http_response_code(404); - include('includes/templates/404.php'); - die(); -} - -$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"> -</head> -<body> -<?php include_once "includes/templates/header.php" ?> - <h1><?= $current->name; ?></h1> - member since <?= date('M d, Y', strtotime($current->date)); ?> -</body> -</html> +<?php
+include_once './includes/model/User.php';
+include_once './includes/model/Thread.php';
+
+if (!isset($_GET['id']) or !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
+ http_response_code(404);
+ include('includes/templates/404.php');
+ die();
+}
+
+$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>
+<?php include_once 'includes/templates/head.php'; ?>
+</head>
+<body>
+<?php include_once "includes/templates/header.php" ?>
+ <h1><?= $current->name; ?></h1>
+ member since <?= date('M d, Y', strtotime($current->date)); ?>
+ <h2><?= $current->name; ?>'s Threads</h2>
+ <table>
+ <tr>
+ <th>Thread</th>
+ <th>Category</th>
+ <th>Latest Post</th>
+ </tr>
+<?php foreach ($current->get_threads() as $thread): ?>
+ <tr>
+ <td>
+ <b><a href="viewthread.php?id=<?= $thread->id ?>"><?= $thread->subject ?></a></b>
+ <small>on <?= date('M d, Y', strtotime($thread->date_created)); ?></small>
+ </td>
+ <td><a href="viewcategory.php?id=<?= $thread->category->id ?>"><?= $thread->category->name ?></a></td>
+<?php $latest_post = $thread->get_latest_post(); if ($latest_post->has_value()): ?>
+ <td>
+ <small>by <b><a href="viewuser.php?id=<?= $latest_post->author->id ?>"><?= $latest_post->author->name ?></a></b>
+ on <?= $latest_post->date_created ?></small>
+ </td>
+<?php else: ?>
+ <td>No posts yet!</td>
+<?php endif ?>
+ </tr>
+<?php endforeach ?>
+ </table>
+</body>
+</html>
|