GET method getting NULL why?
Testing in browser: [email protected]&senha=1241
Code:
session_start();
class Login
{
private $email;
private $senha;
private $db;
public function __construct(PDO $db){
$this->db = $db;
}
public function autenticar($email, $senha){
$query = "select * from clientes where email='$email' and senha=$senha";
echo $query."<br>";
$stmt = $this->db->prepare($query);
$stmt->execute();
if(($stmt->fetch())){
$_SESSION['logado'] = true;
return true;
}
else{
$_SESSION['logado'] = false;
return false;
}
}
}
$email = htmlspecialchars($_GET['$email']);
$senha = htmlspecialchars($_GET['$senha']);
$db = new PDO("mysql:host=localhost;dbname=registroop","root","");
$login = new Login($db);
$resultado = $login->autenticar($email,$senha);
if($resultado)
echo "logado";
else
echo "não logado";
echo "<br>";