simple password

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jamrop
Forum Commoner
Posts: 80
Joined: Fri May 16, 2003 5:38 pm

simple password

Post by jamrop »

Using a form to submit a global password. When the password is entered it goes to cv.php with the following code

Code: Select all

<?php
if ( ! $password == 'in')
&#123; header("location:cv.html") ; exit();&#125;
else &#123; 
   
   header("Location: index.htm"); &#125;

?>
if the password is correct it should open cv.html, but it
does not seem to work, it just goes back to index.htm

can anyone help plz
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Galahad
Forum Contributor
Posts: 111
Joined: Fri Jun 14, 2002 5:50 pm

Post by Galahad »

What happens if the password is incorrect? Maybe you should change:

Code: Select all

<?php
if ( ! $password == 'in')
?>
to be:

Code: Select all

<?php
if ($password == 'in')
?>
That way, if the password is 'in' it goes to cv.html, otherwise it goes to index.html.

twigletmac may be onto something, are you sure $password gets set? Try echoing it.
jamrop
Forum Commoner
Posts: 80
Joined: Fri May 16, 2003 5:38 pm

Post by jamrop »

hey

thanks for help

it was the ! in the code

silly mistake

thanks
Post Reply