java - How to implement username or email login in the same input box?
迷茫
迷茫 2017-05-17 10:02:39
0
3
644

As shown in the two pictures, the user table has username and email fields. When the page is logged in, how to implement the function of logging in with username or email? Looking for answers.

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
给我你的怀抱

Dear, my idea is: if it is xxx@xxx.xxx, it is the email login, otherwise it is the username login.
Correspondingly, if you log in by email, you call the method of querying and verifying the email; if you log in with a username, you call the method of querying and verifying the username.
Above!

过去多啦不再A梦

It can be easily processed and sent directly back to the backend, and the backend can match it in sequence.

刘奇

select * from user where (username=xxxxx and password=yyyy) or (email=xxxxx and password=yyyy)
This is okay too

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!