This is a controller I just made that will check the input password. It's seemed to be no mistakes. But, when I run it, it didn't receive the result (echo "Right password") although I entered the right input.
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class MainController extends Controller
{
private $data = array(
array("TestUser","Password"),
array("Admin","BigA1r")
);
//$this->log($u,$p);
public static function log($username,$pass) { //login
echo "<title>Processing request...</title>";
echo "Logging in... Please wait.";
for ($i = 1;$i == 35;$i++){
$u = $data[$i][1];
if ($u == $username){
$p = $data[$i][2];
if ($p == $pass){
setcookie("username="+$u);//+";password="+p;
echo "Right password";
}else{echo "Wrong password";};
}else{
echo "Can't find this username. Please try a different
name.";
}
}
}
What's the mistake here? I can't find it. And it didn't throw any. It just stopped at echo "Logging in... Please wait.";