summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCflip <36554078+cflip@users.noreply.github.com>2021-01-24 13:46:28 -0700
committerCflip <36554078+cflip@users.noreply.github.com>2021-01-24 13:46:28 -0700
commit6500ec0543a316f9fa5f16a5c47e7103ec9bbe9e (patch)
tree57c252240cf9677b00053b411412d4f698f06a86
parentd2909ea89f5cff052783006ee6596903e9881c73 (diff)
Add more links to user page
-rw-r--r--category.php6
-rw-r--r--index.php6
-rw-r--r--styles/style.css19
3 files changed, 17 insertions, 14 deletions
diff --git a/category.php b/category.php
index f5cf9cb..b26856a 100644
--- a/category.php
+++ b/category.php
@@ -27,7 +27,7 @@ mysqli_free_result($result);
echo '</section>';
-$sql = "SELECT thread_id, thread_subject, thread_date, user_name FROM threads JOIN users ON thread_author = user_id WHERE thread_cat = " . mysqli_real_escape_string($dbc, $_GET['id']) . " ORDER BY thread_id DESC";
+$sql = "SELECT thread_id, thread_subject, thread_date, user_id, user_name FROM threads JOIN users ON thread_author = user_id WHERE thread_cat = " . mysqli_real_escape_string($dbc, $_GET['id']) . " ORDER BY thread_id DESC";
$result = mysqli_query($dbc, $sql);
if (!$result) {
@@ -52,7 +52,9 @@ while ($row = mysqli_fetch_assoc($result)) {
echo '<tr><td class="left">';
echo '<h4><a href="thread.php?id=' . $row['thread_id'] . '">' . $row['thread_subject'] . '</a></h4>';
- echo '<small>by <b>' . $row['user_name'] . '</b> on ' . date('M d, Y', strtotime($row['thread_date'])) . '</small></td><td class="right">by <b>' . $thread['user_name'] . '</b><br><small>' . date('m/d/Y g:ia', strtotime($thread['post_date'])) . '</small></td></tr>';
+ echo '<small>by <b><a href="user.php?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a></b> on ' . date('M d, Y', strtotime($row['thread_date'])) . '</small>';
+ echo '</td><td class="right">by <b><a href="user.php?id=' . $row['user_id'] . '">' . $thread['user_name'] . '</a></b><br>';
+ echo '<small>' . date('m/d/Y g:ia', strtotime($thread['post_date'])) . '</small></td></tr>';
}
mysqli_stmt_close($stmt);
diff --git a/index.php b/index.php
index 2a1c633..fabec83 100644
--- a/index.php
+++ b/index.php
@@ -43,7 +43,7 @@ include_once 'header.php';
echo $row['cat_description'];
if ($thread) {
echo '</td><td class="right">' . $thread['thread_subject'] . '<br>';
- echo '<small>by <b>' . $thread['user_name'] . '</b></small></td></tr>';
+ echo '<small>by <b><a href="user.php?id=' . $thread['user_id'] . '">' . $thread['user_name'] . '</a></b></small></td></tr>';
} else {
$no_threads_msg = 'There are no threads in this category yet.';
echo '</td><td class="right"><small>'. $no_threads_msg .'</small></td>';
@@ -62,7 +62,7 @@ include_once 'header.php';
<?php
include_once 'includes/db_inc.php';
- $sql = "SELECT thread_id, thread_subject, thread_date, user_name, cat_id, cat_name FROM threads JOIN users ON thread_author = user_id JOIN categories ON thread_cat = cat_id ORDER BY thread_id DESC LIMIT 5";
+ $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 ORDER BY thread_id DESC LIMIT 5";
$result = mysqli_query($dbc, $sql);
if (!$result) {
@@ -72,7 +72,7 @@ include_once 'header.php';
while ($row = mysqli_fetch_assoc($result)) {
echo '<tr><td class="left">';
echo '<h4><a href="thread.php?id=' . $row['thread_id'] . '">' . $row['thread_subject'] . '</a></h4>';
- echo '<small>by <b>' . $row['user_name'] . '</b> on ' . date('M d, Y', strtotime($row['thread_date'])) . '</small></td><td class="right">Posted in <a href="category.php?id=' . $row['cat_id'] . '">' . $row['cat_name'] .'</a></td></tr>';
+ echo '<small>by <b><a href="user.php?id=' . $thread['user_id'] . '">' . $row['user_name'] . '</a></b> on ' . date('M d, Y', strtotime($row['thread_date'])) . '</small></td><td class="right">Posted in <a href="category.php?id=' . $row['cat_id'] . '">' . $row['cat_name'] .'</a></td></tr>';
}
mysqli_free_result($result);
diff --git a/styles/style.css b/styles/style.css
index e0b7358..fe7c56c 100644
--- a/styles/style.css
+++ b/styles/style.css
@@ -46,6 +46,15 @@ form {
display: inline-block;
}
+a {
+ color: #000;
+}
+
+a:hover {
+ color:#373737;
+ text-decoration: none;
+}
+
#title {
color: #eee;
margin: 20px;
@@ -76,6 +85,7 @@ nav a {
}
nav a:hover {
+ color: #FFF;
background-color: #009FC1;
}
@@ -87,15 +97,6 @@ nav a:hover {
width: 30%;
}
-table a {
- color: #000;
-}
-
-table a:hover {
- color:#373737;
- text-decoration: none;
-}
-
h1, h4 {
margin-top: 2px;
margin-bottom: 10px;