Geicy

Untitled

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