Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Login{
- private $email;
- private $senha;
- private $nome;
- public function __construct($email, $senha, $nome){
- $this->setEmail($email);
- $this->setSenha($senha);
- $this->nome = $nome;
- }
- //Getters
- public function getNome(){
- return $this->nome;
- }
- public function getEmail(){
- return $this->email;
- }
- public function getSenha(){
- return $this->senha;
- }
- //Setters
- public function setEmail($e){
- $email = filter_var($e,FILTER_SANITIZE_EMAIL);
- $this->email = $email;
- }
- public function setSenha($e){
- $this->senha = $e;
- }
- public function Logar() {
- if($this->email == "teste@teste.com" and $this->senha == "123456"):
- echo "Logado com sucesso!";
- else:
- echo "Dados inválidos";
- endif;
- }
- }
- $logar = new Login("teste@teste.com", "123456", "Marcos" );
- $logar->Logar();
- echo "<hr>";
- echo $logar->getNome()."<br>".$logar->getEmail()."<br>". $logar->getSenha();
Add Comment
Please, Sign In to add comment