Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // setter e getters
- class Login
- {
- private $email;
- private $senha;
- private $nome;
- public function __construct($email, $senha, $nome)
- {
- $this->nome = $nome;
- $this->setSenha($senha);
- $this->setEmail($email);
- }
- public function getNome()
- {
- return $this->nome;
- }
- 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 == "123456") :
- echo "Logado com sucesso";
- else :
- echo "Dados invalidos";
- endif;
- }
- }
- $logar = new Login("teste@teste.com", "123456", "Gleidosn junio");
- $logar->Logar();
- echo "<br>";
- echo $logar->getNome();
Add Comment
Please, Sign In to add comment