March 17, 2018, 03:56:14 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   Home   Help Search Login Register  
Pages: [1]
Author Topic: Password Protection  (Read 5123 times)
Posts: 1

« on: December 16, 2006, 06:51:45 PM »

First... I really like the script.

Second... I have the script included in the top of my page. After the user signs in I read the cookie to determine a variable for a report. When the report runs the first time it is empty. If I refresh the page it works very nicely using the md5 password saved in the cookie.

Any ideas why I have to refresh the page to get it to work correctly?

I am new to php.

Hero Member
Posts: 785

« Reply #1 on: December 19, 2006, 07:12:50 AM »

Do you check it like this in your program?
if ($_COOKIE['verify'] !== "")

Password protector sets cookie using setcookie function. I think cookie goes into $_COOKIE array only after page is refreshed.

If you want script to populate $_COOKIE array first time, then replace following code in the password protect:
    // set cookie if password was validated
    setcookie("verify", md5($pass));

    // set cookie if password was validated
    setcookie("verify", md5($pass));
    $_COOKIE['verify'] == md5($pass);
Pages: [1]
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC