i am using the following password code http://www.zubrag.com/scripts/password-protect.php
it is working fine but when i try to echo out the logged in user’s info, i am only able to do it once, at the time of login. after that if i refresh the page, the page is still accessible but the logged in user’s name is not echoed out
can someone help me with this
i have the following code on the first line of the pages that i want to protect
<?php require("/home/abcd/abcd/password_protect.php"); ?>
i am echoing out the name by using
echo "Welcome $login";
What the script basically does is that it has a pre-initialised list of login and passwords stored in the array
$LOGIN_INFORMATION.Now it takes a login/password combination from the user and matches with the stored values.
As per your question , you want to show the name of the authenticated user.
For that you can use a session
At the start of the page(Very first line) write
then
$_SESSION['username'] = $username//the authenticated usernameNow at the beginning of every page where you want to print the name ,write
then
After you are done and you want to log out ( or cancel the session) write