lynxus Posted February 18, 2009 Share Posted February 18, 2009 Hi guys this is probably simple, However google isnt helping. I have people logged into my site using htaccess. How do i get the username they have used into a var? ie: $username = ['loggedinname']; Echo "Welcome $username"; Any help would be great. Thanks G Quote Link to comment Share on other sites More sharing options...
gizmola Posted February 18, 2009 Share Posted February 18, 2009 So to interpret what you mean, you are using built-in HTTP or "realms" authentication. This page should help you: http://us.php.net/features.http-auth One issue with this form of authentication is that there is essentially no way to log out a user once they are authenticated. The user literally needs to close the browser to clear the credentials. They are sent in the HTTP header with every request, so they also aren't the best, since anyone sniffing even one HTTP request will see the credentials. Quote Link to comment Share on other sites More sharing options...
lynxus Posted February 18, 2009 Author Share Posted February 18, 2009 Thanks That url helped. for anyone else who may end up searching Im using . <?php echo "You are logged in as {$_SERVER['PHP_AUTH_USER']}"; ?> Quote Link to comment Share on other sites More sharing options...
Cal Posted February 18, 2009 Share Posted February 18, 2009 Thanks for posting that lynxus, I might use it too . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.