# Check session variable before delivering cached page

**URL:** https://forum.shopware.com/t/check-session-variable-before-delivering-cached-page/52365
**Category:** International (English Only)
**Tags:** programming
**Created:** [13. April 2018 um 13:26 UTC](https://forum.shopware.com/t/check-session-variable-before-delivering-cached-page/52365 "2018-04-13T13:26:55Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![flynorc](https://avatars.discourse-cdn.com/v4/letter/f/90db22/32.png) [@flynorc](https://forum.shopware.com/u/flynorc)
#### Post date: [19. April 2018 um 16:05 UTC](https://forum.shopware.com/t/check-session-variable-before-delivering-cached-page/52365/9 "2018-04-19T16:05:02Z")

</div>

All pages are available only after login. With the obvious exceptions of the login form itself and the action that processes the submitted data, that is what the code below does

```
if(empty($passengerId) && $controllerName !== "passenger") {
    $controller->redirect('frontend/passenger/login');
}

```

The customer should be logged in for the time of the session duration. If he/she comes back in a week he/she should log in again. trying to keep it as simple as possible.

thank you for your help

---

_[View the full topic](https://forum.shopware.com/t/check-session-variable-before-delivering-cached-page/52365)._
