Comparing input to a password in a flatfile

Hello,
I’m trying to set up a little puzzle where if someone solves the puzzle a password is displayed in an image. They must then type that password into a text input box to move on to the next page. On page challenge1.php I have the following code:

Password for next Challenge:

On page challenge2.php I have the following code before the tag:

<?php function CheckLogin($pw) { $valid=false; $f = fopen("password1.txt","r"); $line = fgets($f); if ($line = $pw) $valid=true; } if($valid=true) return=true; else return=false; ?> <?php if(!CheckLogin($_POST=['password'])) echo "Error"; else header('Location: challenge2.php'); ?>

I’m getting an unexpected ‘=’ on line 10 type of error. Any help would be appreciated!

Nevermind! I fixed it all up! Thank you anyway!

Sponsor our Newsletter | Privacy Policy | Terms of Service