From 2805ef7311eeb028cd48bffe04a705676c4682be Mon Sep 17 00:00:00 2001
From: cflip <36554078+cflip@users.noreply.github.com>
Date: Sun, 21 Mar 2021 10:54:47 -0600
Subject: big changes pt1
---
user.php | 70 ++++++++++++++++++++++++----------------------------------------
1 file changed, 26 insertions(+), 44 deletions(-)
(limited to 'user.php')
diff --git a/user.php b/user.php
index 62b9144..a5e1d16 100644
--- a/user.php
+++ b/user.php
@@ -1,56 +1,38 @@
-Go home.';
-}
-
-if (!isset($_GET['id'])) {
- nobody_is_here();
-} else {
- // If this is the user's own page, show the 'options' bar
- echo '';
+session_start();
- $sql = 'SELECT user_id, user_name, user_date FROM users WHERE user_id=?';
- $stmt = mysqli_stmt_init($dbc);
+$user_name = "Unknown";
+$user_date = 0;
- if (!mysqli_stmt_prepare($stmt, $sql)) {
- die('Could not create thread due to internal error: ' . mysqli_error($dbc));
- }
- mysqli_stmt_bind_param($stmt, 'i', $_GET['id']);
- mysqli_stmt_execute($stmt);
- $res = mysqli_stmt_get_result($stmt);
- $user = mysqli_fetch_assoc($res);
-
- if (!$user) {
- nobody_is_here();
- } else {
- echo ''. $user['user_name'] .'
';
- echo 'Member since '. date('M d, Y', strtotime($user['user_date']));
- }
-
- if (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $_GET['id']) {
- echo '
Change Password
';
- }
-
- echo '';
-
- $sql = "SELECT thread_id, thread_subject, thread_date, user_id, user_name, cat_id, cat_name FROM threads JOIN users ON thread_author = user_id JOIN categories ON thread_cat = cat_id WHERE thread_author = " . $user['user_id'] . " ORDER BY thread_id DESC";
+if (!isset($_GET['name'])) {
+} else {
+ $sql = "SELECT user_date FROM users WHERE user_name = '" . $_GET['name'] . "'";
$result = mysqli_query($dbc, $sql);
if (!$result) {
- die('Error trying to display threads: ' . mysqli_error($dbc));
+ die('Error trying to display user page: ' . mysqli_error($dbc));
}
- echo '' . $user['user_name'] . '\'s Threads | Latest Post |
';
- display_threads($dbc, $result, true);
- mysqli_free_result($result);
- echo '
';
+ if (mysqli_num_rows($result) == 0) {
+ $user_name = "Unknown";
+ } else {
+ while ($row = mysqli_fetch_assoc($result)) {
+ $user_name = $_GET['name'];
+ $user_date = $row['user_date'];
+ }
+ }
}
?>
-
-
+
+
+
+ 's Profile - cflip.net forum
+
+
+
+
+ member since
+
+
\ No newline at end of file
--
cgit v1.2.3