Jump to content

[SOLVED] Password function problem [updated for new code]


mattd8752

Recommended Posts

Could someone try and fix the php script I have included as an attachment.  It is supposed to include a file which will have the commands for a password protection.  This password protection is running from an include.  And it is calling the page pass.txt for the md5 encripted version of the password.  I don't think that is the problem though, the error recieved is

Parse error: syntax error, unexpected T_BOOLEAN_OR, expecting ',' or ')' in /home/mattd/public_html/commands/scripts/requestpassword.php on line 10

You can check that out at http://mattdsworld.theicy.net/commands/

Please help with this as soon as possible.  I am trying to develop a command set.  If you don't quite understand what the script is doing you can check doc.txt.

[attachment deleted by admin]
Thanks,
[code]
<?php
function requestpass()
{
$filename = "./data/pass.txt";
$handle = fopen($filename, "r");
$cpass = fread($handle, filesize($filename));
fclose($handle);
$pass = $_POST['pass'];
$pass = md5($pass);
if (!isset ($_POST['Login'] && $pass != $cpass)) // display form
{
?>
<form method="POST" action="<?php echo $PHP_SELF; ?>">
<p>Password: <input type="text" name="pass" size="20"><input type="submit" value="Login" name="Login"></p>
</form>
<?php
}
else{ // correct password.  Display page.
}
?>


<?php
function requestpassend()
{
}
}
?>
[/code]

There is the full code.  Don't bother with the download.  I fixed 1 problem from it, but still the same error.  You can still see the results at that website.  That page is requestpassword.php.
Don't bump so quickly -- most of us have other work to do other than solve your problems.

Anyway, your missing a closing parenthesis on this line:
[code]<?php
if (!isset ($_POST['Login'] && $pass != $cpass)) // display form
?>[/code]
after "$_POST['Login']

It also looks like you have one too many "}" at the end of your script. If you learn to indent your code properly you will be able to see many syntax errors.

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.