I need to show logged user's name

163 Views Asked by At

I am using this webpage password protector

It's working fine but i want to make the logged user's name appears in the protected page after logging in successfully. May you please help me ?

1

There are 1 best solutions below

8
On BEST ANSWER

Modify this part of your code:

  else {
    // set cookie if password was validated
    setcookie("verify", md5($login.'%'.$pass), $timeout, '/');

    // Some programs (like Form1 Bilder) check $_POST array to see if parameters passed
    // So need to clear password protector variables
    unset($_POST['access_login']);
    unset($_POST['access_password']);
    unset($_POST['Submit']);
  }

to read as:

  else {
    // set cookie if password was validated
    setcookie("verify", md5($login.'%'.$pass), $timeout, '/');

    echo "Username: " . $login;

    // Some programs (like Form1 Bilder) check $_POST array to see if parameters passed
    // So need to clear password protector variables
    unset($_POST['access_login']);
    unset($_POST['access_password']);
    unset($_POST['Submit']);
  }