View content based on if a new session is created
On Drupal, when a new user logs in, a new session is started; when the session expires, the user must log in again. You just need to use the hook that Drupal uses when a user logs in, which is hook_user_login(). Take system_user_login() as code example.

function system_user_login(&amp;$edit, $account) {
  // If the user has a NULL time zone, notify them to set a time zone.
  if (!$account-&gt;timezone &amp;&amp; variable_get('configurable_timezones', 1) &amp;&amp; variable_get('empty_timezone_message', 0)) {
    drupal_set_message(t('Configure your &lt;a href="@user-edit"&gt;account time zone setting&lt;/a&gt;.', array('@user-edit' =&gt; url("user/$account-&gt;uid/edit", array('query' =&gt; drupal_get_destination(), 'fragment' =&gt; 'edit-timezone')))));
  }
}


Keep in mind that PHP variables don't persist between sessions. If, for example, you need to show the content only once for users, you need to use code similar to the following one.

function mymodule_user_login(&amp;$edit, $account) {
  if (variable_get("mymodule_show_message_{$account-&gt;uid}", 1)) {
    // Show the message.
    variable_set("mymodule_show_message_{$account-&gt;uid}", 0);
  }
}


For anonymous users, you cannot count on the session being saved between two different page requests. Drupal, at the end of a page request, destroys the session for anonymous users, if it is empty. See drupal_session_commit().

  if (empty($user-&gt;uid) &amp;&amp; empty($_SESSION)) {
    // There is no session data to store, destroy the session if it was
    // previously started.
    if (drupal_session_started()) {
      session_destroy();
    }
  } 


For a solution that works for both the anonymous users and authenticated users, I would rather implement hook_page_build(), although this has the side effect of always creating the session for anonymous users, with all the consequences.

function mymodule_page_build(&amp;$page) {
  if (empty($_SESSION['mymodule_page_disclaimer_shown'])) {
    // This is a new session. Show the disclaimer.
    $page['page_top']['disclaimer'] = array(
      '#markup' =&gt; t('Acme, Inc. is not responsible for the contents of this sample code.'),
      '#weight' =&gt; 0,
    );
    $_SESSION['mymodule_page_disclaimer_shown'] = TRUE;
  }
}


In this way, since the session is not empty, it won't be destroyed from Drupal after serving the page. The second time the anonymous users visit the site using the same computer/browser, the disclaimer will not be shown.