سؤال

I have a htaccess and htpasswd file. I want that if e.g.: user1 logs in give a message that Welcome 'user1'!

My main problem is that I don't know how to tell to the php file that user1 is logged in ...

هل كانت مفيدة؟

المحلول

I believe you can access the logged in user with this:

$_SERVER['PHP_AUTH_USER']

It's been a while since I last used it though

if (isset($_SERVER['PHP_AUTH_USER']))
{
    echo "Hello {$_SERVER['PHP_AUTH_USER']}!";
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top