|
|
@ -1,6 +1,28 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
class WebUsers extends Users{
|
|
|
|
class WebUsers extends Users{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private $uId;
|
|
|
|
|
|
|
|
private $login;
|
|
|
|
|
|
|
|
private $email;
|
|
|
|
|
|
|
|
private $firstname;
|
|
|
|
|
|
|
|
private $lastname;
|
|
|
|
|
|
|
|
private $gender;
|
|
|
|
|
|
|
|
private $country;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function __construct($UId = 0) {
|
|
|
|
|
|
|
|
$this->uId = $UId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function set($values){
|
|
|
|
|
|
|
|
$this->uId = $values['UId'];
|
|
|
|
|
|
|
|
$this->login = $values['Login'];
|
|
|
|
|
|
|
|
$this->email = $values['Email'];
|
|
|
|
|
|
|
|
$this->firstname = $values['FirstName'];
|
|
|
|
|
|
|
|
$this->lastname = $values['LastName'];
|
|
|
|
|
|
|
|
$this->gender = $values['Gender'];
|
|
|
|
|
|
|
|
$this->country = $values['Country'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Function checkUserNameExists
|
|
|
|
* Function checkUserNameExists
|
|
|
@ -46,33 +68,43 @@ class WebUsers extends Users{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getId($username){
|
|
|
|
public static function getId($username){
|
|
|
|
$dbw = new DBLayer("web");
|
|
|
|
$dbw = new DBLayer("web");
|
|
|
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:username", array('username' => $username));
|
|
|
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:username", array('username' => $username));
|
|
|
|
$row = $statement->fetch();
|
|
|
|
$row = $statement->fetch();
|
|
|
|
return $row['UId'];
|
|
|
|
return $row['UId'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getUsername($id){
|
|
|
|
public function getUsername(){
|
|
|
|
$dbw = new DBLayer("web");
|
|
|
|
$dbw = new DBLayer("web");
|
|
|
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $id));
|
|
|
|
if(! isset($this->login) || $this->login == ""){
|
|
|
|
$row = $statement->fetch();
|
|
|
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId));
|
|
|
|
return $row['Login'];
|
|
|
|
$row = $statement->fetch();
|
|
|
|
|
|
|
|
$this->set($row);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->login;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getEmail($id){
|
|
|
|
public function getEmail(){
|
|
|
|
$dbw = new DBLayer("web");
|
|
|
|
$dbw = new DBLayer("web");
|
|
|
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $id));
|
|
|
|
if(! isset($this->email) || $this->email == ""){
|
|
|
|
$row = $statement->fetch();
|
|
|
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId));
|
|
|
|
return $row['Email'];
|
|
|
|
$row = $statement->fetch();
|
|
|
|
|
|
|
|
$this->set($row);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->email;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getInfo($id){
|
|
|
|
public function getInfo(){
|
|
|
|
$dbw = new DBLayer("web");
|
|
|
|
$dbw = new DBLayer("web");
|
|
|
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $id));
|
|
|
|
if(! (isset($this->firstname) && isset($this->lastname) && isset($this->gender) && isset($this->country) ) ||
|
|
|
|
$row = $statement->fetch();
|
|
|
|
$this->firstname == "" || $this->lastname == "" || $this->gender == "" || $this->country == ""){
|
|
|
|
$result = Array('FirstName' => $row['FirstName'], 'LastName' => $row['LastName'], 'Gender' => $row['Gender'], 'Country' => $row['Country']);
|
|
|
|
$statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId));
|
|
|
|
return $result;
|
|
|
|
$row = $statement->fetch();
|
|
|
|
|
|
|
|
$this->set($row);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = Array('FirstName' => $this->firstname, 'LastName' => $this->lastname, 'Gender' => $this->gender, 'Country' => $this->country);
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function isLoggedIn(){
|
|
|
|
public function isLoggedIn(){
|
|
|
|