I've been using PHP Session to stay logged in when I'm using a browser but when I save the web app to my Home Screen and launch the app, I have to Sign In each time I open up the app. Is there a way to stay signed in?

Could anyone supply an example of code or point me in the right direction as I looked into Local Storage and not sure how to set the LocalStorage value when I am Logged In and how to check the value exists.

NOTE: I currently use PHP to Sign In

Thanks

**index.php**

```
<script type="text/javascript">
    <?php echo $_SESSION['logged'];?> 
    <?php if ($_GET['logged'] == 1){?>
        $.cookie( 'loggedin', '1',  { expires: 7, path: '/' } );
    <?php }?>
        if( $.cookie('loggedin') == '1' ) { 
            <?php $userlog = true?>
            $.cookie( 'loggedin', '1',  { expires: 7, path: '/' } );
        } else {
            <?php $userlog = false?>
        $.cookie( 'loggedin', '0',  { expires: 7, path: '/' } );        
        }
</script>

```

$\_SESSION['logged'] is set from the sign-in.php file

**sign-in.php**

```
    if($count==1) {
        session_register("username");
        $_SESSION['logged']= $user;
        header("location: /?logged=1");
    } else {
        echo "Your Login Name or Password is invalid";
    }

```