public function __construct()
 {
     require_once '../app/helpers/Checkout_helper.php';
     session_start();
     if (!Sessions_helper::logged_in()) {
         $this->redirect_to('sessions/login?redirect=checkout');
         break;
     } elseif (!isset($_SESSION['checkout'])) {
         $_SESSION['checkout'] = [];
         $this->redirect_to('checkout/index');
         break;
     }
     if ($_SESSION['cart'] == null) {
         $this->redirect_to('carts');
     }
     //Redirect to earlier page if previous information is missing
     if (!isset($_SESSION['redirecting'])) {
         $stages = ['address', 'deliveryMethod', 'paymentMethod'];
         foreach ($stages as $stage) {
             if ($_SESSION['checkout']['properties'][$stage] == null) {
                 $_SESSION['redirecting'] = true;
                 $this->redirect_to('checkout/' . $stage);
                 break;
             }
         }
     } else {
         unset($_SESSION['redirecting']);
     }
 }
 protected function mustBeLoggedIn($url = false)
 {
     if (!Sessions_helper::logged_in()) {
         if ($url == false) {
             $url = $_GET['url'];
         }
         $this->redirect_to('sessions/login?redirect=' . $url);
     }
 }
 public function removeItem()
 {
     if (Sessions_helper::logged_in()) {
         require_once '../app/models/Cart.php';
         $cart = new Cart();
         $cart->removeItem($_POST['productVersionId']);
     } else {
         if (array_key_exists($_POST['productVersionId'], $_SESSION['cart'])) {
             unset($_SESSION['cart'][$_POST['productVersionId']]);
             if (count($_SESSION['cart']) == 0) {
                 unset($_SESSION['cart']);
             }
         }
     }
     $this->redirect_to('carts');
 }
<div id="account-header">
	<div>
		<span>
			<?php 
if (Sessions_helper::logged_in()) {
    ?>
				Hello, <?php 
    echo Sessions_helper::currentUser()['first_name'];
    ?>
!
				<span class="logout"><?php 
    $this->link_to('sessions/logout', 'Logout');
    ?>
</span>
			<?php 
} else {
    ?>
				Hello. <?php 
    $this->link_to('sessions/login', 'Sign in');
    ?>
 or 
				<?php 
    $this->link_to('users/newuser', 'register');
    ?>
.
			<?php 
}
?>
		</span>
		<?php 
if (Sessions_helper::userIsAdmin()) {