Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Gallery{
- var $error = "nothing is available at the moment";
- var $company;
- var $image;
- var $username;
- var $password;
- var $validated;
- function __construct($username, $password) {
- $this->username = $username;
- $this->password = $password;
- $this->validate();
- }
- //USER ID GET/SET
- public function getUsername() {return $this->username;}
- public function getCompany() {return $this->company;}
- //VALIDATE USER
- public function validate(){
- $sql = "
- SELECT *
- FROM gallery_accounts
- WHERE gallery_accounts_username = '".$this->username."' AND gallery_accounts_password = '".$this->password."'
- ";
- $result = mysql_query($sql) or die("Query failed: ".$sql);
- if(mysql_num_rows($result)){
- $row = mysql_fetch_array($result);
- $this->company = $row['gallery_accounts_company'];
- $this->image = $row['gallery_accounts_image'];
- $this->username = $row['gallery_accounts_username'];
- $this->validated = true;
- } else {
- $this->company = '';
- $this->username = '';
- $this->validated = false;
- }
- }
Add Comment
Please, Sign In to add comment