Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class userAuth {
- public $username;
- public $user_id;
- private $password;
- private $_resultCode;
- public function __construct($username,$password) {
- $this->username = $username;
- $this->password = $password;
- $this->_resultCode = -1;
- }
- public function getResultCode() {
- return $this->_resultCode;
- }
- public function authenticateUser($dbConnect) {
- $qry_username = $this->username;
- $user_query = "SELECT * FROM users_tbl WHERE username='$qry_username'";
- $user_result = mysql_query($user_query,$dbConnect);
- if(mysql_num_rows($user_result) > 0) {
- $this->_resultCode = 1;
- while ($user_row = mysql_fetch_assoc($user_result)) {
- if ($user_row['password'] == md5($this->password)) {
- $this->user_id = $user_row['user_id'];
- $this->_resultCode = 2;
- }
- }
- } else $this->_resultCode = -1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement