Question: Can you fix this PHP file please to the following: 1- the login will be the same just make the user can input email or

Can you fix this PHP file please to the following:

1- the login will be the same just make the user can input email or username.

2- in registration part can you include the username and confirm a password.

Here is the code:

Survey System

Login


validation($_POST['username']); $email = $fm->validation($_POST['email']); $password = $fm->validation($_POST['password']); $username = mysqli_real_escape_string($db->link,$username); $email = mysqli_real_escape_string($db->link,$email); $password = mysqli_real_escape_string($db->link,$password);

if($email=='admin@admin.com' && $password=='1111'){ Session::set("adminsession","admin@admin.com"); echo ""; exit; }

$query = "SELECT * FROM username WHERE Email = '$email'"; $result = $db->select($query); if($result!= false){

$value = $result->fetch_assoc(); $dbpassword = $value['Password']; if(password_verify($password, $dbpassword)){ Session::set("login",true); Session::set("email",$value['Email']); Session::set("userId",$value['Username_ID']); echo ""; }else{ echo "Email and Password do not matched !!! "; } }else{ } } ?>

Register

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!