Guest User

Untitled

a guest
Mar 12th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. Gallery{
  2. var $error = "nothing is available at the moment";
  3. var $company;
  4. var $image;
  5. var $username;
  6. var $password;
  7. var $validated;
  8.  
  9.  
  10. function __construct($username, $password) {
  11. $this->username = $username;
  12. $this->password = $password;
  13. $this->validate();
  14. }
  15.  
  16. //USER ID GET/SET
  17. public function getUsername() {return $this->username;}
  18. public function getCompany() {return $this->company;}
  19.  
  20.  
  21. //VALIDATE USER
  22. public function validate(){
  23. $sql = "
  24. SELECT *
  25. FROM gallery_accounts
  26. WHERE gallery_accounts_username = '".$this->username."' AND gallery_accounts_password = '".$this->password."'
  27. ";
  28. $result = mysql_query($sql) or die("Query failed: ".$sql);
  29. if(mysql_num_rows($result)){
  30. $row = mysql_fetch_array($result);
  31. $this->company = $row['gallery_accounts_company'];
  32. $this->image = $row['gallery_accounts_image'];
  33. $this->username = $row['gallery_accounts_username'];
  34. $this->validated = true;
  35. } else {
  36. $this->company = '';
  37. $this->username = '';
  38. $this->validated = false;
  39. }
  40. }
Add Comment
Please, Sign In to add comment