Frage

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

War es hilfreich?

Lösung

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']}!";
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top