Question

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 ...

Était-ce utile?

La solution

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']}!";
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top