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.
精彩评论