开发者

Hide value from unregistered user

Could you all give me an idea on how can i hide a specific value from an unregisted user? 开发者_StackOverflow社区But once a user logins, that value should be visible?


Use sessions. Once user logs in, set a flag or user id in $_SESSION array. Later, you can check this flag and generate different output for registered/unregistered user. I.e.

if ($_SESSION['logged_id'])
{
    // print protected contents
}
else 
{
   // print public contents
}


Either regenerate the page and then you can see that they are registered, so show the number.

Or, once they register, then pass back the number as part of the result and then the javascript can display it.

But, don't just hide it in the html, as then they can view source and see it anyway.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜