简体   繁体   中英

Issue with PHP login & registration form without using a database

Could anyone help me making a login function that checks the txt document if user and pw exists/are correct? -and if they are, sends you to a logged in page. This is for a assignment which is why I have to store the information in a text document, I know it's unsafe. Also i know i should use $_Sessions but I'm not sure how to use it and where to put it.

So far I have created the form which has 2 buttons one for registering and

in your register method you are not passing password ?

$hash = password_hash('', PASSWORD_DEFAULT);

also in your login method you need password_verify instead of password_hash

if (password_verify(trim($pass), trim($tmp[1]))){

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM