login with username or email address in php

前端 未结 8 2284
面向向阳花
面向向阳花 2021-02-01 10:56

I am trying to create a login with username or email

My code is:

$username=$_REQUEST[\'login\'];
$email=$_REQUEST[\'login\'];
$password=$_REQUEST[\'passw         


        
8条回答
  •  粉色の甜心
    2021-02-01 11:37

    $username=$_REQUEST['login'];
    $email=$_REQUEST['login'];
    

    This is wrong, you are using $_REQUEST['login'] for both email and username. Why don't you just use email?

    If $_REQUEST['login'] doesn't have email address, of course this wont return you anything.

    Also, both of your if statements will always execute, unless the fields are empty. right?

    Take the login out, enforce the users to login with email addresses. also, take md5 of the password. who stores raw passwords these days?

提交回复
热议问题