Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // setter e getters
- class Login
- {
- private $email;
- private $senha;
- public function getEmail()
- {
- return $this->email;
- }
- public function setEmail($e)
- {
- $email = filter_var($e, FILTER_SANITIZE_EMAIL); // filtraNDO EMAIL
- $this->email = $email;
- }
- public function getSenha()
- {
- return $this->senha;
- }
- public function setSenha($s)
- {
- $this->senha = $s;
- }
- public function logar()
- {
- if ($this->email == "teste@teste.com" and $this->senha == "12345") :
- echo "Logado com sucesso";
- else :
- echo "Dados invalidos";
- endif;
- }
- }
- $logar = new Login();
- $logar->setEmail("teste//()@teste.com"); // FOI FILTRADO
- $logar->setSenha("12345");
- $logar->logar();
- echo "<br>";
- echo $logar->getEmail();
- echo $logar->getSenha();
Add Comment
Please, Sign In to add comment