Example #1
0
 public static function getCurrentUser()
 {
     if (self::checkIfAuthenticated()) {
         $query = new UserQuery();
         $user = $query->findPk($_SESSION[self::$SESSION_USER_ID]);
         return $user;
     } else {
         return null;
     }
 }
<?php

if (!isset($_SESSION)) {
    session_start();
}
if (isset($_SESSION['uid'])) {
    //get user from uid
    $q = new UserQuery();
    $user = $q->findPk($_SESSION['uid']);
}
?>

<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <!-- these three spans are decoration for the expand button -->
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="/RPIWannaHangOut/index.php">RPIWannaHangOut</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><a href="/RPIWannaHangOut/explore.php">Explore</a></li>
        <?php