Search code examples
phphtmlauthenticationno-database

Prefill login form from link php


I have made a php login for my family's website private links.

Would it be possible to prefill the login details if I emailed a family member a link? Also, could I also have another link that automatically logs the user in?

I used to protect my family links with .htaccess/.htpasswd and it would be simple to do this with something like like this:

http://user:[email protected]/family/protectedlinks/

Solution

  • In this case you need to use GET parameters. For example

    http://myfamilysite.com/family/protectedlinks/?user=LONG_HASH&password=LONG_HASH

    In PHP file receive this request, you just need Decrypt this Hash. You can login your family directly or pre fill all form, and his just need to click on submit function. The second alternative is more security, because you don't get directly your application.

    In email you pass this link with pessoal access for members of your family.