Pergunta

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

Foi útil?

Solução

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']}!";
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top