diff options
| author | cflip <36554078+cflip@users.noreply.github.com> | 2021-04-07 11:44:11 -0600 | 
|---|---|---|
| committer | cflip <36554078+cflip@users.noreply.github.com> | 2021-04-07 11:44:11 -0600 | 
| commit | d61a18a93bc1b39d91725497ebb2fe85c4785ead (patch) | |
| tree | 20403b00b2672c2183966989173d9dec2f4523dc | |
| parent | 6dd221f59e4b8fd0c824ee9831b6efdbecb3aee7 (diff) | |
Update links, rename files
| -rw-r--r-- | index.php | 12 | ||||
| -rw-r--r-- | model/Post.php | 4 | ||||
| -rw-r--r-- | templates/header.php | 12 | ||||
| -rw-r--r-- | viewcategory.php (renamed from category.php) | 8 | ||||
| -rw-r--r-- | viewthread.php (renamed from thread.php) | 0 | ||||
| -rw-r--r-- | viewuser.php (renamed from user.php) | 6 | 
6 files changed, 23 insertions, 19 deletions
@@ -42,16 +42,20 @@  			echo '<tr>';  			echo '<td>'; -			echo '<b><a href="category/' . $category->id . '">' . $category->name . '</a></b>'; +			echo '<b><a href="viewcategory.php?id=' . $category->id . '">' . $category->name . '</a></b>';  			echo '<br>' . $category->description;  			echo '</td>';  			echo '<td>' . $category->thread_count . '</td>';  			echo '<td>' . $category->post_count . '</td>'; -			echo '<td><b><a href="./thread/' . $latest_thread->id . '">' . $latest_thread->subject . '</a></b><br>';  -			echo '<small>by <b><a href="./user/' . $latest_thread->author->name . '">' . $latest_thread->author->name . '</a></b>, ' . $latest_thread->date_created . '</small></td>'; +			if (!is_null($latest_thread)) { +				echo '<td><b><a href="viewthread.php?id=' . $latest_thread->id . '">' . $latest_thread->subject . '</a></b><br>'; +				echo '<small>by <b><a href="viewuser.php?id=' . $latest_thread->author->id . '">' . $latest_thread->author->name . '</a></b>, ' . $latest_thread->date_created . '</small></td>'; +			} else { +				echo '<td>No threads yet!</td>'; +			}  			echo '</tr>';  		}  	?>  	</table>  </body> -</html>
\ No newline at end of file +</html> diff --git a/model/Post.php b/model/Post.php index bcaff29..d10a505 100644 --- a/model/Post.php +++ b/model/Post.php @@ -37,7 +37,7 @@ class Post {  	}  	function display_content() { -		echo '<div>#' . $this->id . ' Posted by <a href="/forum/user/'. $this->author->name .'">' . $this->author->name . '</a> on ' . date('m/d/Y g:ia', strtotime($this->date)) . '<br></div>'; +		echo '<div>#' . $this->id . ' Posted by <a href="viewuser.php?id='. $this->author->id.'">' . $this->author->name . '</a> on ' . date('m/d/Y g:ia', strtotime($this->date)) . '<br></div>';  		$post_content = $this->content; @@ -79,4 +79,4 @@ function get_all_posts($dbc) {  	mysqli_free_result($result);  	return $posts; -}
\ No newline at end of file +} diff --git a/templates/header.php b/templates/header.php index d7b8b78..4eb17e3 100644 --- a/templates/header.php +++ b/templates/header.php @@ -1,14 +1,14 @@  <h1>cflip.net forum<sup style="font-size: small;">beta</sup></h1> -[<a href="/forum/">Home</a>] -[<a href="/forum/search.php?type=thread&sort=lr">All Threads</a>] -[<a href="/forum/search.php?type=post&sort=cd">All Posts</a>] -[<a href="/forum/create_thread.php">Create a thread</a>] +[<a href="/">Home</a>] +[<a href="/search.php?type=thread&sort=lr">All Threads</a>] +[<a href="/search.php?type=post&sort=cd">All Posts</a>] +[<a href="/create_thread.php">Create a thread</a>]  <span style="float:right;">  	<?php  	if (isset($_SESSION['signed_in'])) { -		echo '[<a href="/forum/user/'. $_SESSION['user_name'] .'">' . $_SESSION['user_name'] . '\'s Profile</a>] [<a href="includes/signout_inc.php">Log out</a>]'; +		echo '[<a href="viewuser.php?id='. $_SESSION['user_id'] .'">' . $_SESSION['user_name'] . '\'s Profile</a>] [<a href="includes/signout_inc.php">Log out</a>]';  	} else {  		echo '[<a href="signin.php">Sign in</a>] or [<a href="register.php">Register an account</a>]';  	}  	?> -</span>
\ No newline at end of file +</span> diff --git a/category.php b/viewcategory.php index b149237..ebdc03f 100644 --- a/category.php +++ b/viewcategory.php @@ -52,11 +52,11 @@ if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {  			$latest_post = $thread->get_latest_post($dbc);  			echo '<tr>'; -			echo '<td><b><a href="../thread/' . $thread->id . '">' . $thread->subject . '</a></b><br>';  -			echo '<small>by <b><a href="../user/' . $thread->author->name . '">' . $thread->author->name . '</a></b> on ' . date('M d, Y', strtotime($thread->date_created)) . '</small></td>'; +			echo '<td><b><a href="viewthread.php?id=' . $thread->id . '">' . $thread->subject . '</a></b>'; +			echo ' by <b><a href="viewuser.php?id=' . $thread->author->id . '">' . $thread->author->name . '</a></b> on ' . date('M d, Y', strtotime($thread->date_created)) . '</td>';  			if (!is_null($latest_post)) { -				echo '<td>by <b><a href="../user/' . $latest_post->author->name . '">' . $latest_post->author->name . '</a></b><br><small>on ' . $latest_post->date . '</small></td>'; +				echo '<td>by <b><a href="viewuser.php?id=' . $latest_post->author->id . '">' . $latest_post->author->name . '</a></b> on ' . $latest_post->date . '</td>';  			} else {  				echo '<td>No posts yet!</td>';  			} @@ -66,4 +66,4 @@ if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {  		?>  	</table>  </body> -</html>
\ No newline at end of file +</html> diff --git a/thread.php b/viewthread.php index f784e40..f784e40 100644 --- a/thread.php +++ b/viewthread.php @@ -6,9 +6,9 @@ session_start();  $current = new User(); -if (!isset($_GET['name'])) { +if (!isset($_GET['id'])) {  } else { -	$current->get_by_name($_GET['name'], $dbc); +	$current->get_by_id($_GET['id'], $dbc);  }  ?>  <!DOCTYPE html> @@ -21,4 +21,4 @@ if (!isset($_GET['name'])) {  	<h1><?php echo $current->name; ?></h1>  	member since <?php echo date('M d, Y', strtotime($current->date)); ?>  </body> -</html>
\ No newline at end of file +</html>  | 
