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