1

I have this code used to check login details. Specially to check password from user entered data and data in SQL.

if ($request->input('password') != $fromUser[0]->Password) {
    $currentStatus = "invalid_password";
  }

This code works well in my local machine. Checking case sensitive too. It mean when "$request->input('password')" = "DemoTest" and "$fromUser[0]->Password" = "demotest",
it's not matching and return false ($currentStatus = "invalid_password";).

But when I hosted this on server, this is not working. Not checking case sensitive and if above condition happened, it gives me true.
Why is that ? I hosted this in Windows server. But my local machine is Linux.

Bibhudatta Sahoo
  • 4,808
  • 2
  • 27
  • 51
Chanaka De Silva
  • 401
  • 9
  • 20

1 Answers1

1

As you are dealing with Password then you need to use Hash code to store the password in DB and use strcmp to password match.
Try like this

$var1=Hash::make($var1);
if(strcmp($var1, $var2) != 0) {
    $currentStatus = "invalid_password";
 }

I thing it will work for you.

Bibhudatta Sahoo
  • 4,808
  • 2
  • 27
  • 51