|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP Passwords
Hey. I've been trying to create a password protection on my Mom's website for the past two days, but have failed.
I have tried two different methods and nothing. It keeps asking whether or not I really want to download the php file, but I am trying to get it to use the file to send it to an html webpage so only certain people can enter the website. That is not how it is working out at all. Below is the original...please tell me what I am doing wrong! <?php> $passwords = array("bill" =>"apple", "charles"=>"potato", "david" =>"igneous", "janet" =>"tomask"); if ($password == $passwords[$username]) { setcookie("username", $username, time()+1200); echo "<H2>Access granted.</H2>"; } else { setcookie("username", "", time()-3600); echo "<H2>Invalid user name or password: access denied.</H2>"; } ?> |
|
#2
|
|||
|
|||
|
i would suggest using $_session['']; like this:
PHP Code:
|
|
#3
|
|||
|
|||
|
Thank you so much. I would just like to say on the record...that moms are a pain in the butt.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP Passwords |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|