Fill in the login field with your username OR email

Luca Kammerer

I built a register and login system on my website. Now I asked myself a question that I cannot answer. I have three inputs on my registration page:

  1. Username
  2. Email
  3. Password

I would now like to have two inputs on my login page instead. The first should be for password and the second for email OR username. I now wonder how it is possible to do this with the MySQL database?

I am still very new to PHP. I hope someone can answer, I haven't found anything on Stack Overflow.

ImranGalib
  1. First when you post the form with 2 fields try to validate if input given is of type email or not
  2. Here is how you do it https://www.php.net/manual/en/filter.examples.validation.php
  3. now you know which column against the value is to be passed
  4. if the username is not of type email use username column
  5. if username is of type email use email column instead.

Prepare your query accordingly

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TOP Ranking

HotTag

Archive