Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. <?php
  2.     session_start();
  3.     $link = mysql_connect('localhost', 'c4dev', 'westech2005') or
  4.     die ('Could not connect: ' . mysql_error());
  5.  
  6.     $db_selected = mysql_select_db('c4dev', $link) or
  7.         die ('could not use db: ' . mysql_error());
  8.        
  9.     class userAuth {
  10.         public $username;
  11.         private $password;
  12.         private $_resultCode;
  13.        
  14.         public function _construct($username,$password) {
  15.             $this->username = $username;
  16.             $this->password = $password;
  17.             $this->_resultCode = -1;
  18.         }
  19.    
  20.         public function getResultCode() {
  21.             return $this->_resultCode;
  22.         }
  23.        
  24.         public function authenticateUser() {
  25.             if($this->username == "billy") {
  26.                 $this->_resultCode = 1;
  27.                 if ($this->password == "test") $this->_resultCode = 2;
  28.             } else $this->_resultCode = -1;
  29.         }
  30.        
  31.     }
  32. ?>
  33.  
  34. <?php
  35.     $user_auth = new userAuth("test", "123");      
  36.     echo $user_auth->username;
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement