---
title: "Example: Protected Content"
description: Learn how to use the Smart Content module to create password protected content for your website project.
---

[Skip to content](https://support.sitemanager.io/en/logic/password-protected-content/example-1-protected-content#main-content)

[![SiteManager Platform](https://support.sitemanager.io/hs-fs/hubfs/SM_Platform-logo.png?width=164&height=40&name=SM_Platform-logo.png)](https://support.sitemanager.io/en?hsLang=en)

Open main navigation

Close main navigation

- [Go to sitemanager.io](https://www.sitemanager.io/)

[Go to sitemanager.io](https://www.sitemanager.io/)

 How can we help?

- There are no suggestions because the search field is empty.

1. [Knowledge Base](https://support.sitemanager.io/en?hsLang=en)
2. [Logic (Smart Content)](https://support.sitemanager.io/en/logic-smart-content?hsLang=en)
3. [Password Protected Content](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#password-protected-content)

# Example: Protected Content

## Learn how to use the Smart Content module to create password protected content for your website project.

Our Smart Content module has recently been renamed to Logic. All documentation will be updated with the new name in the future.

 

With the Smart Content module you can create password protected pages for your website.

Due to GDPR regulations we can't offer a full fledged login platform of our own yet. We recommend you integrate a platform like [antumID](https://www.antumid.be/) or [Amazon Cognito](https://aws.amazon.com/cognito/) using Smart API. 

 

<iframe class="hs-responsive-embed-iframe" height="315" src="https://www.youtube.com/embed/TYSetjhhAj8" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;" width="560" allowfullscreen data-service="youtube"></iframe>

 

If you haven't read the get started with smart content articles: you find them here:

[https://support.sitemanager.io/what-is-smart-content](https://support.sitemanager.io/what-is-smart-content?hsLang=en)

[https://support.sitemanager.io/installing-smart-content-premium-module](https://support.sitemanager.io/installing-smart-content-premium-module?hsLang=en)

[https://support.sitemanager.io/manage-smart-content](https://support.sitemanager.io/manage-smart-content?hsLang=en)

[https://support.sitemanager.io/smart-content-configuration](https://support.sitemanager.io/smart-content-configuration?hsLang=en)

[https://support.sitemanager.io/implement-smart-content](https://support.sitemanager.io/implement-smart-content?hsLang=en)

[https://support.sitemanager.io/smart-rules-in-the-sitemanager-cms](https://support.sitemanager.io/smart-rules-in-the-sitemanager-cms?hsLang=en)

 

In our example we are adding a download page to our website that is only available for our clients who have the login password.

![screenshot\_login](https://support.sitemanager.io/hs-fs/hubfs/screenshot_login.jpg?width=688&name=screenshot_login.jpg)

 

### Step 1. Smart Configuration

We go to the code application \> smart content and create a private group for our login.

![logingroup](https://support.sitemanager.io/hs-fs/hubfs/logingroup.jpg?width=688&name=logingroup.jpg)

We made sure storage session is enabled.

 

We check the configuration for login forms and access logic.

![loginconfig](https://support.sitemanager.io/hs-fs/hubfs/loginconfig.jpg?width=688&name=loginconfig.jpg)

For login forms you can post directly to the login and logout file and use the reload option to automatically reload the page when the user is logged in. If you want to use a more controlled option using JavaScript, we recommend to set the option to no reload.

[https://support.sitemanager.io/smart-content-configuration](https://support.sitemanager.io/smart-content-configuration?hsLang=en) (step 3 and 4).

### Step 2. Creating a login form

You can create a login form anywhere. You can build it inside a layout component when you have multiple protected pages. 

In this example we only have one protected page so we created a page component.

This is the example code of the login form we created. We used the reload setting so we are posting directly to swfiles/lib/protected.

![logincode](https://support.sitemanager.io/hs-fs/hubfs/logincode.jpg?width=592&name=logincode.jpg)

In the CMS we used the access logic rule to show this only to visitors who are not in the login group

![logincmsoptions](https://support.sitemanager.io/hs-fs/hubfs/logincmsoptions.jpg?width=688&name=logincmsoptions.jpg)

 

![loginsmartrule](https://support.sitemanager.io/hs-fs/hubfs/loginsmartrule.jpg?width=567&name=loginsmartrule.jpg)

 

Code example  login form (with reload setting)

```
[:nocontent:id:(<form action="swfiles/lib/protected.php" method="post">    <div class="form-group">        <input type="password" class="form-control" name="sPass" placeholder="Password">    </div>    <button type="submit" class="s-btn">Login</button></form>):/nocontent:]
```

 

Code example  login form (with jquery - no reload setting)

```
[:nocontent:id:(<form action="#" id="loginFORM" method="post">    <div class="form-group">        <input type="password" class="form-control" name="sPass" placeholder="Password">    </div>    <button type="submit" id="sitebtnLOGIN" class="s-btn">Login</button></form><script>    $("document").ready(function(){        $('#sitebtnLOGIN').click(function(event){            event.preventDefault();            $.post( "swfiles/lib/protected.php", $('#loginFORM').serializeArray(), function( data ) {                var logOBJ = $.parseJSON(data);                if((logOBJ.status.type == "success") && (logOBJ.status.code == "100")){                    console.log("log in success");                } else {                    console.log("log in error: " + logOBJ.status.message);                }            });        });    });</script>):/nocontent:]
```

 

Here we added the access logic directly inside the code using the **\[:nocontent:id:():/nocontent:\]** implementation

 

### Step 3. Creating a logout button

Similar to the login form we can code this button anywhere we want. In this example we build a page component. In most cases these types of buttons might be added somewhere in the header navigation.

Here is the code of our component. Since we are still using the reload option we post the form directly to the file.

![logoutcode](https://support.sitemanager.io/hs-fs/hubfs/logoutcode.jpg?width=606&name=logoutcode.jpg)

In a similar way as step 2 we added the access logic that this piece of content is only visible when the visitor has access to the group login.

![logoutcmsoptions](https://support.sitemanager.io/hs-fs/hubfs/logoutcmsoptions.jpg?width=634&name=logoutcmsoptions.jpg)

![logoutrule](https://support.sitemanager.io/hs-fs/hubfs/logoutrule.jpg?width=537&name=logoutrule.jpg)

 

Code example  logout form (with reload setting)

```
[:showcontent:id:(<form action="swfiles/lib/logout.php" method="post">    <button type="submit" class="s-btn">Logout</button></form>):/endcontent:]
```

When you logout you will logout from all your groups if you want to logout from a specific group you can add it's id as a parameter (**sID**)

```
swfiles/lib/logout.php?sID=1
```

 

Code example  logout form (with jquery - no reload setting)

```
[:showcontent:id:(<form action="#" id="logoutFORM" method="post">    <button type="submit" id="sitebtnLOGOUT" class="s-btn">Logout</button></form><script>    $("document").ready(function(){        $('#sitebtnLOGOUT').click(function(event){            event.preventDefault();            $.post( "swfiles/lib/logout.php", $('#logoutFORM').serializeArray(), function( data ) {                var logOBJ = $.parseJSON(data);                if((logOBJ.status.type == "success") && (logOBJ.status.code == "100")){                    console.log("logout success");                } else {                    console.log("logout error: " + logOBJ.status.message);                }            });        });    });</script>):/endcontent:]
```

 

Here we added the access logic directly inside the code using the **\[:showcontent:id:():/endcontent:\]** implementation

### Step 4. Protected content

To create protected content we simply use smart rules (access logic) or add the function **\[:showcontent:id:():/endcontent:\]** to the code of our protected components.

In our example we created a page component with the download button and added access logic via the options button.

![downloadoptions](https://support.sitemanager.io/hs-fs/hubfs/downloadoptions.jpg?width=688&name=downloadoptions.jpg)

Access behavior: show content to login group

![logoutrule](https://support.sitemanager.io/hs-fs/hubfs/logoutrule.jpg?width=537&name=logoutrule.jpg)

 

### Step 5. Publish

Once the website is published you can test the login form.

![screenshot\_loggedin](https://support.sitemanager.io/hs-fs/hubfs/screenshot_loggedin.jpg?width=688&name=screenshot_loggedin.jpg)

 

- [Getting Started](https://support.sitemanager.io/en/getting-started?hsLang=en)
- [Dashboard](https://support.sitemanager.io/en/dashboard?hsLang=en#main-content)

    - [Getting Started](https://support.sitemanager.io/en/dashboard?hsLang=en#getting-started)
    - [Project Dashboard](https://support.sitemanager.io/en/dashboard?hsLang=en#project-dashboard)
    - [White Label & Add-ons](https://support.sitemanager.io/en/dashboard?hsLang=en#white-label-add-ons)
    - [Go Live](https://support.sitemanager.io/en/dashboard?hsLang=en#go-live)
- [Account](https://support.sitemanager.io/en/account?hsLang=en#main-content)

    - [Account Settings](https://support.sitemanager.io/en/account?hsLang=en#account-settings)
    - [My Company](https://support.sitemanager.io/en/account?hsLang=en#my-company)
    - [Subscription](https://support.sitemanager.io/en/account?hsLang=en#subscription)
- [Project](https://support.sitemanager.io/en/project?hsLang=en#main-content)

    - [General](https://support.sitemanager.io/en/project?hsLang=en#general)
    - [Upgrade Project](https://support.sitemanager.io/en/project?hsLang=en#upgrade-project)
- [SEO](https://support.sitemanager.io/en/seo?hsLang=en#main-content)

    - [Basics](https://support.sitemanager.io/en/seo?hsLang=en#basics)
    - [Advanced](https://support.sitemanager.io/en/seo?hsLang=en#advanced)
- [Go Live](https://support.sitemanager.io/en/go-live?hsLang=en#main-content)

    - [Prepare Project](https://support.sitemanager.io/en/go-live?hsLang=en#prepare-project)
    - [Prepare Domain](https://support.sitemanager.io/en/go-live?hsLang=en#prepare-domain)
    - [Going Live](https://support.sitemanager.io/en/go-live?hsLang=en#going-live)
- [Content](https://support.sitemanager.io/en/content?hsLang=en#main-content)

    - [Getting Started](https://support.sitemanager.io/en/content?hsLang=en#getting-started)
    - [Page Management](https://support.sitemanager.io/en/content?hsLang=en#page-management)
    - [Content Management](https://support.sitemanager.io/en/content?hsLang=en#content-management)
    - [Language Management](https://support.sitemanager.io/en/content?hsLang=en#language-management)
    - [Image Library](https://support.sitemanager.io/en/content?hsLang=en#image-library)
    - [Collaborating on a project](https://support.sitemanager.io/en/content?hsLang=en#collaborating-on-a-project)
- [Page Components](https://support.sitemanager.io/en/page-components?hsLang=en#main-content)

    - [Getting Started](https://support.sitemanager.io/en/page-components?hsLang=en#getting-started)
    - [HTML](https://support.sitemanager.io/en/page-components?hsLang=en#html)
    - [CSS](https://support.sitemanager.io/en/page-components?hsLang=en#css)
    - [JavaScript (JS)](https://support.sitemanager.io/en/page-components?hsLang=en#javascript-js)
    - [How To](https://support.sitemanager.io/en/page-components?hsLang=en#how-to)
- [Layout Components](https://support.sitemanager.io/en/layout-components?hsLang=en)
- [No-Code Editor](https://support.sitemanager.io/en/no-code-editor?hsLang=en#main-content)

    - [Getting Started](https://support.sitemanager.io/en/no-code-editor?hsLang=en#getting-started)
    - [Properties](https://support.sitemanager.io/en/no-code-editor?hsLang=en#properties)
    - [Advanced](https://support.sitemanager.io/en/no-code-editor?hsLang=en#advanced)
- [Design](https://support.sitemanager.io/en/design?hsLang=en#main-content)

    - [Overview](https://support.sitemanager.io/en/design?hsLang=en#overview)
    - [Design editor](https://support.sitemanager.io/en/design?hsLang=en#design-editor)
    - [Design Panels](https://support.sitemanager.io/en/design?hsLang=en#design-panels)
    - [Responsive](https://support.sitemanager.io/en/design?hsLang=en#responsive)
    - [Fonts](https://support.sitemanager.io/en/design?hsLang=en#fonts)
    - [Layouts](https://support.sitemanager.io/en/design?hsLang=en#layouts)
- [Code](https://support.sitemanager.io/en/code?hsLang=en#main-content)

    - [Introduction](https://support.sitemanager.io/en/code?hsLang=en#introduction)
    - [Token Management](https://support.sitemanager.io/en/code?hsLang=en#token-management)
    - [Project Setup](https://support.sitemanager.io/en/code?hsLang=en#project-setup)
    - [ToolStack](https://support.sitemanager.io/en/code?hsLang=en#toolstack)
    - [Private Library](https://support.sitemanager.io/en/code?hsLang=en#private-library)
- [Dynamic Content](https://support.sitemanager.io/en/dynamic-content?hsLang=en#main-content)

    - [Getting started](https://support.sitemanager.io/en/dynamic-content?hsLang=en#getting-started)
    - [Basics](https://support.sitemanager.io/en/dynamic-content?hsLang=en#basics)
    - [Advanced](https://support.sitemanager.io/en/dynamic-content?hsLang=en#advanced)
- [External Content](https://support.sitemanager.io/en/external-content?hsLang=en#main-content)

    - [Getting started](https://support.sitemanager.io/en/external-content?hsLang=en#getting-started)
    - [Configuration & implementation](https://support.sitemanager.io/en/external-content?hsLang=en#configuration-implementation)
- [Logic (Smart Content)](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#main-content)

    - [Getting Started](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#getting-started)
    - [Configuration & Implementation](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#configuration-implementation)
    - [Logic](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#logic)
    - [AB testing](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#ab-testing)
    - [Timed Content](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#timed-content)
    - [Password Protected Content](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#password-protected-content)
    - [Smart API](https://support.sitemanager.io/en/logic-smart-content?hsLang=en#smart-api)
- [Integrations](https://support.sitemanager.io/en/integrations?hsLang=en#main-content)

    - [Getting Started](https://support.sitemanager.io/en/integrations?hsLang=en#getting-started)
    - [Integrations](https://support.sitemanager.io/en/integrations?hsLang=en#integrations)
    - [Advanced](https://support.sitemanager.io/en/integrations?hsLang=en#advanced)
- [Modules](https://support.sitemanager.io/en/modules?hsLang=en#main-content)

    - [Getting Started](https://support.sitemanager.io/en/modules?hsLang=en#getting-started)
    - [Modules](https://support.sitemanager.io/en/modules?hsLang=en#modules)
- [Upgrade Center](https://support.sitemanager.io/en/upgrade-center?hsLang=en#main-content)

    - [Components](https://support.sitemanager.io/en/upgrade-center?hsLang=en#components)
- [Forms](https://support.sitemanager.io/en/forms?hsLang=en#main-content)

    - [General](https://support.sitemanager.io/en/forms?hsLang=en#general)
    - [Captcha](https://support.sitemanager.io/en/forms?hsLang=en#captcha)
    - [Form Actions](https://support.sitemanager.io/en/forms?hsLang=en#form-actions)
    - [Extending Forms](https://support.sitemanager.io/en/forms?hsLang=en#extending-forms)
    - [Email Templates](https://support.sitemanager.io/en/forms?hsLang=en#email-templates)
    - [Advanced](https://support.sitemanager.io/en/forms?hsLang=en#advanced)
- [Cookie Settings](https://support.sitemanager.io/en/cookie-settings?hsLang=en#main-content)

    - [Getting Started](https://support.sitemanager.io/en/cookie-settings?hsLang=en#getting-started)
    - [Configuration](https://support.sitemanager.io/en/cookie-settings?hsLang=en#configuration)
- [API Call](https://support.sitemanager.io/en/api-call?hsLang=en#main-content)

    - [Configuration](https://support.sitemanager.io/en/api-call?hsLang=en#configuration)

[![SiteManager Icon](https://support.sitemanager.io/hs-fs/hubfs/logo_icon_big.png?width=15&height=24&name=logo_icon_big.png "SiteManager Icon")](https://support.sitemanager.io/en?hsLang=en)

 

<https://www.facebook.com/TeamSiteManager/> <https://twitter.com/TeamSiteManager/> <https://www.instagram.com/teamsitemanager/> <https://www.linkedin.com/company/sitemanager/> <https://www.youtube.com/user/SiteMNGR/>

Copyright © 2026, SiteManager Group