Anders Moen Posted January 30, 2007 Share Posted January 30, 2007 I wanna create a page that's only for members with .htaccess, and I've had a code (from DynamicDrive), but I didn't get it work.Can anyone help me with this? And if a user is logged in, I want it to say "Logged in as username", but how do I make it remember the username like that?I appreciate your help Link to comment Share on other sites More sharing options...
vchris Posted January 30, 2007 Share Posted January 30, 2007 For the logged in as username. It doesn't remember it. It gets the username value in the session variables define when the user logs in.Logged in as <?php $_SESSION['username']; ?>I'm not sure about .htaccess never used it. Link to comment Share on other sites More sharing options...
Anders Moen Posted January 30, 2007 Author Share Posted January 30, 2007 That wasn't really much help.... Thanks anywayAnyone who can help me? Link to comment Share on other sites More sharing options...
boen_robot Posted January 30, 2007 Share Posted January 30, 2007 In order to authenticate with .htaccess, your server must be set to support .htaccess as well as the modules required for this. Read How to on authentication for details.As for how to display the name of the one logged in, you need to enable SSIs and/or CGI if they are not already enabled. Then, create an *.shtml file and in it, type: Logged in as <!--#echo var="REMOTE_USER" encoding="none"--> Then simply protect that *.shtml file. When the user is logged in, (s)he will see the message. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now