mariofont / PHP-Login

Simple, easy-to-use, and database-free login system.
48 stars 33 forks source link

Password type #6

Open Imikeeee opened 4 years ago

Imikeeee commented 4 years ago

How can i make a new password? What is the default password hash type?

danvanbueren commented 4 years ago

See https://github.com/mariofont/PHP-Login/issues/3#issuecomment-640791054

Use the PHP method password_hash() - see https://www.php.net/manual/en/function.password-hash.php.

Example: $var = 'my-password'; $hash = password_hash($var, PASSWORD_DEFAULT);

Imikeeee commented 4 years ago

I writed this on the config.php: echo password_hash("root1337", PASSWORD_DEFAULT); and i got this : $2y$10$HK8Fp4uiX2Rybd6jNeGVZOqZ.f/.lIX5ruonDxGR6cJc9JsEF3BQK

and i also changed the usernamte to : root

and i still cant login ;-;

the login.php said : Warning! Incorrect information.

my config.php looks like :

<?php / Define username and password / $Username = "root"; $Password = "$2y$10$HK8Fp4uiX2Rybd6jNeGVZOqZ.f/.lIX5ruonDxGR6cJc9JsEF3BQK"; //$Password = "$2y$10$1GmNO63bbKWpaPxcqLaLW.yVmvoxyOD9krWXxn2XAY.QSdbfcARDK"; //echo password_hash("root1337", PASSWORD_DEFAULT); ?>

Alternating commented 6 months ago

for those looking for help

  1. open the config.php
  2. change the username to whatever you want
  3. on the most bottom empty line enter with no quotes "echo password_hash("passwordhere", PASSWORD_DEFAULT);"
  4. point your webbrowser at http://youwebsite.com/config.php and it will output the hash
  5. copy the entire output including a period at the end if it is generated and input that into the password field in config.php
  6. remove the echo line and save your config
  7. login with your login and password. Ensure you use the text version of your password to login not the salt that was generated