If you use CakePHP, then the right way is to use
AuthComponent::loggedIn()<http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#AuthComponent::loggedIn>
To display user name use
$this->Auth->user('username');<http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#AuthComponent::user>
If you use native PHP:
if(!isset($_SESSION['username'])) {
echo "Why you dont register ?";
} else {
echo $_SESSION['username'];
}
or
echo !isset($_SESSION['username']) ? "Why you dont register ?"
: $_SESSION['username'];
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.