Zubrag.com
June 22, 2018, 10:16:10 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]
  Print  
Author Topic: Password Protection  (Read 5282 times)
shornesr
Newbie
*
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.

Logged
zubrag
Administrator
Hero Member
*****
Posts: 786


WWW
« 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));

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

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