tags:

views:

31

answers:

2

Hello all! Could you all give me an idea on how can i hide a specific value from an unregisted user? But once a user logins, that value should be visible?

Thanks :)

+2  A: 

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
}
a1ex07
+1  A: 

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.

James Black
Ya you are right. You can get the value from the source code. I had completely forgotten that! Thanks!
chupinette