Geicy

Untitled

Jul 20th, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. class Login {
  4.     private $email;
  5.     private $senha;
  6.  
  7.     public function getEmail() {
  8.         return $this->email;
  9.     }
  10.  
  11.     public function setEmail($e) {
  12.         $email = filter_var($e, FILTER_SANITIZE_EMAIL);
  13.         $this->email = $email;
  14.     }
  15.  
  16.  
  17.     public function getSenha() {
  18.         return $this->senha;
  19.     }
  20.  
  21.     public function setSenha($s) {
  22.         $this->senha = $s;
  23.     }
  24.  
  25.  
  26.     public function Logar(){
  27.         if($this->email == "teste@teste.com" and $this->senha == "123456" ):
  28.             echo "Logado com sucesso!";
  29.         else:
  30.             echo "Dados inválidos";
  31.         endif;
  32.     }
  33. }
  34.  
  35. $logar = new Login();
  36. $logar->setEmail("teste///@teste.com");
  37. $logar->setSenha("123456");
  38. $logar->Logar();
  39. echo "<br>";
  40. echo $logar->getEmail();
  41. echo "<br>";
  42. echo $logar->getSenha();
  43.  
Add Comment
Please, Sign In to add comment