开发者

How do you make 2 different views for logged in/not logged in like facebook's newsfeed/login pages?

I was wondering how facebook does their login and newsfeed pages under the same URL, and in a secure way too.

Basically, how do you change the view of the same URL if a person is logged in or not? And would the best way to do this be using a combination of jQuery, PHP, and开发者_StackOverflow CSS? Would you have to try something like

If ($_Session['Authenticated'] == yes){
    (#logged_in).show();
    (#not_logged_in).hide();
} else {
    (#logged_in).hide();
    (#not_logged_in).show();
}

and then go about designing the

<div id="#logged_in>   {everything a logged in user should see}    </div>
<div id="#not_logged_in>    {everything a not logged in user should see}    </div>


That's almost about what I would do but I wouldn't use JavaScript. As a general rule JavaScript is not very secure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜