Personally, I would store each forum/post they view in a column in the database as a csv (comma separated value) or some other character (space) and then place those into an array in a session:
<?php
$conn = mysql_connect("db_host", "username", "password");
mysql_select_db("database_name", $conn);
$query = "SELECT viewed FROM `table_name`";
$database_result = mysql_query($query);
$_SESSION['viewed_topics'] = explode(",", $database_result);
?>
Then, when you want to display your page, just check to see if in_array() is true or false. If it's true, display one image, if not, display another. Then do the same for posts/topics.
Essentially the $_SESSION['viewed_topics'] would be a multi-dimensional array storing only the values of the forum IDs that that user has viewed.
~Brett