Jump to content

PHP password Hash/Varify

vorticalbox
	<?php
$password ="letmein";
echo $password."<br>";
$hash = password_hash($password, PASSWORD_DEFAULT);
echo $hash."<br>";

if (password_verify($password, $hash)) {
    echo 'Password is valid!';
} else {
    echo 'Invalid password.';
}
?>
Parse error: syntax error, unexpected '$hash' (T_VARIABLE), expecting ',' or ')' in C:\xampp\htdocs\includes\hash.php on line 7

I don't see anything wrong with my code.

 

EDIT: deleted the if statement and wrote it out again and it works fine :/

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

After removing the "\n" at the end of line 4, that code works as intended for me, so I'm not sure why it wouldn't be working for you. If you dump get_defined_constants(), are any of the PASSWORD_ constants defined?

 

EDIT: This response was to a previous version of the post

Edited by colonel_mortis

HTTP/2 203

Link to comment
Share on other sites

Link to post
Share on other sites

after removing the "\n" the if didn't work as in new OP, but after deleting it and typing it by hand rather than coping it from another page works.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×