- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
require_once ('./main/config.php');
class user
{
/*
private login;
private password;
private username;
private about;
*/
function registerUser($login, $password, $username, $about)
{
$db = MysqliDb::getInstance();
$data = Array ("login" => $login,
"password" => $password,
"username" => $username,
"about" => $about,
);
$id = $db->insert ('users', $data);
if($id)
echo 'user was created. Id=' . $id;
}
function authorizeUser($login, $password)
{
$db->where ("id", 1);
$user = $db->getOne ("users");
echo $user['id'];
/*
$logins = $db->getValue ("users", "login", null);
// select login from users
// select login from users limit 5
foreach ($logins as $login)
echo $login;
*/
}
}
Ну как вам? Класс юзера для регистрации и авторизации (недоделан)