Commit dba1827f authored by Zohten's avatar Zohten

new DB

parent bb698cdf
...@@ -30,25 +30,40 @@ class User extends Model ...@@ -30,25 +30,40 @@ class User extends Model
$stm = parent::exec('USER_GET_WITH_LOGIN', ['login' => $login]); $stm = parent::exec('USER_GET_WITH_LOGIN', ['login' => $login]);
return $stm->fetchAll(PDO::FETCH_CLASS, 'User')[0]; return $stm->fetchAll(PDO::FETCH_CLASS, 'User')[0];
} }
public function id()
public function password()
{ {
return trim($this->USER_PASSWORD); return trim($this->ID_USER);
} }
public function id() public function role()
{ {
return trim($this->USER_ID); return trim($this->ID_ROLE);
} }
public function firstname() public function password()
{
return trim($this->PASWORD);
}
public function avatar()
{ {
return trim($this->USER_FIRSTNAME); return trim($this->AVATAR);
} }
public function lastname() public function lastname()
{ {
return trim($this->USER_LASTNAME); return trim($this->LASTNAME);
}
public function firstname()
{
return trim($this->FIRSTNAME);
} }
public function email() public function email()
{ {
return trim($this->USER_EMAIL); return trim($this->MAIL);
}
public function isBanned()
{
return trim($this->BAN_ACCOUNT);
}
public function lastIP()
{
return trim($this->LAST_IP);
} }
} }
...@@ -2,30 +2,31 @@ ...@@ -2,30 +2,31 @@
User::addSqlQuery( User::addSqlQuery(
'USER_LIST', 'USER_LIST',
'SELECT * FROM USER ORDER BY USER_LOGIN' 'SELECT * FROM MJ_USER ORDER BY LOGIN'
); );
User::addSqlQuery( User::addSqlQuery(
'USER_GET_WITH_LOGIN', 'USER_GET_WITH_LOGIN',
'SELECT * FROM USER WHERE USER_LOGIN=:login' 'SELECT * FROM MJ_USER WHERE LOGIN=:login'
); );
User::addSqlQuery( User::addSqlQuery(
'USER_GET_WITH_ID', 'USER_GET_WITH_ID',
'SELECT * FROM USER WHERE USER_ID=:id' 'SELECT * FROM MJ_USER WHERE ID_USER=:id'
); );
//TODO
User::addSqlQuery( User::addSqlQuery(
'USER_CREATE', 'USER_CREATE',
'INSERT INTO USER (USER_ID, USER_LOGIN, USER_EMAIL, USER_ROLE, USER_PASSWORD, USER_NAME, USER_SURNAME) VALUES (NULL, :login, :email, :role, :pwd, :name, :surname)' 'INSERT INTO MJ_USER (USER_ID, USER_LOGIN, USER_EMAIL, USER_ROLE, USER_PASSWORD, USER_NAME, USER_SURNAME) VALUES (NULL, :login, :email, :role, :pwd, :name, :surname)'
); );
User::addSqlQuery( User::addSqlQuery(
'USER_CONNECT', 'USER_CONNECT',
'SELECT * FROM USER WHERE USER_LOGIN=:login and USER_PASSWORD=:password' 'SELECT * FROM MJ_USER WHERE LOGIN=:login and PASWORD=:password'
); );
User::addSqlQuery( User::addSqlQuery(
'USER_UPDATE', 'USER_UPDATE',
'UPDATE USER SET USER_EMAIL = :email WHERE USER_ID = :id' 'UPDATE MJ_USER SET MAIL = :email WHERE ID_USER = :id'
); );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment