Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2.     class userAuth {
  3.         public $username;
  4.         private $password;
  5.         private $_resultCode;
  6.        
  7.         public function _construct($username,$password) {
  8.             $this->username = $username;
  9.             $this->password = $password;
  10.             $this->_resultCode = -1;
  11.         }
  12.    
  13.         public function getResultCode() {
  14.             return $this->_resultCode;
  15.         }
  16.        
  17.         public function authenticateUser() {
  18.             if($this->username == "billy") {
  19.                 $this->_resultCode = 1;
  20.                 if ($this->password == "test") $this->_resultCode = 2;
  21.             } else $this->_resultCode = -1;
  22.         }
  23.        
  24.     }
  25. ?>
  26.  
  27. <?php
  28.     $user_auth = new userAuth("test", "123");      
  29.     echo $user_auth->username;
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement