Hi, guys
It's my class
CODE
class auth{
public $username; $password; $connection; $database; $firstname;
public $permission = array();
public function auth(){
require('adodb.inc.php');
$this->database = NewADOConnection($driver);
if($this->database){
$this->connection = $this->database->Connection($host,$user,$pass,$db);
if($this->connection){
return $this->database;
}
}
}
public function __setName($username){
$this->username = $username;
}
public function __getName($username){
return $this->username;
}
public function __setPass($password){
$this->$password = $password;
}
public function __getPass($password){
return $this->$password;
}
public isValid(){
if($this->db->Execute('SELECT name FROM user WHERE user = '.$this->username)){
return true;
}
}
What should I do to design this class better?
If I use the singleton pattern to check if I have a instance of adodb and retrieve that, would the connection still be opened?
I want to use just one connection to do transactions with the database to all other classes
How do I implement that?