diff --git a/app/Controllers/Api/Register.php b/app/Controllers/Api/Register.php index c4d99dd..b384585 100644 --- a/app/Controllers/Api/Register.php +++ b/app/Controllers/Api/Register.php @@ -56,7 +56,7 @@ class Register ) ); - DB::query('INSERT INTO users VALUES (\'0\', :username, :email, :password, :photourl, 5, :content)', array(':username' => ltrim($username), ':password' => password_hash(ltrim($password), PASSWORD_BCRYPT), ':photourl'=>'/static/img/avatar.png', ':email' => $email, ':content' => $content)); + DB::query('INSERT INTO users VALUES (\'0\', :username, :email, :password, :photourl, 5, :online, :content)', array(':username' => ltrim($username), ':password' => password_hash(ltrim($password), PASSWORD_BCRYPT), ':photourl'=>'/static/img/avatar.png', ':email' => $email, ':content' => $content, ':online'=>time())); $cstrong = True; $token = GenerateRandomStr::gen_uuid(); $user_id = DB::query('SELECT id FROM users WHERE username=:username', array(':username' => $username))[0]['id']; diff --git a/app/Controllers/ProfileController.php b/app/Controllers/ProfileController.php new file mode 100644 index 0000000..0798df0 --- /dev/null +++ b/app/Controllers/ProfileController.php @@ -0,0 +1,22 @@ + 0) { - + Router::get('/lk', 'ProfileController@lk'); } else { - //Router::redirect('/login?return='.$_SERVER['HTTP_REFERER']); + Router::redirect('/login?return='.$_SERVER['HTTP_REFERER']); } } } diff --git a/app/Models/User.php b/app/Models/User.php index 3a42772..6587593 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -11,5 +11,9 @@ class User { public function i($table) { return DB::query("SELECT * FROM users WHERE id=:id", array(':id'=>$this->userid))[0][$table]; } + public function content($table) { + $content = json_decode(self::i('content'), true); + return $content[$table]; + } } \ No newline at end of file diff --git a/app/Services/Auth.php b/app/Services/Auth.php index 437ef3e..92fcdd0 100644 --- a/app/Services/Auth.php +++ b/app/Services/Auth.php @@ -14,7 +14,7 @@ class Auth if ($userInfo && count($userInfo) > 0) { $userid = $userInfo[0]['user_id']; - //DB::query('UPDATE users SET online=:timed WHERE id=:id', array(':id'=>$userid, ':timed'=>time())); + DB::query('UPDATE users SET online=:timed WHERE id=:id', array(':id'=>$userid, ':timed'=>time())); } } diff --git a/static/img/avatar.png b/static/img/avatar.png new file mode 100644 index 0000000..730037c Binary files /dev/null and b/static/img/avatar.png differ diff --git a/views/pages/Profile/Index.php b/views/pages/Profile/Index.php index e69de29..c0a6821 100644 --- a/views/pages/Profile/Index.php +++ b/views/pages/Profile/Index.php @@ -0,0 +1,107 @@ + + + + + + + + + + + + +
+ + + + + +
+

i('username') ?>

+ i('id') === Auth::userid()) { ?> +

Редактировать мой профиль

+ + + + + + +
+
+ + + content('location') !== null) { ?> + + + + + + + + + + + + + + + + + + + + + +
Откуда:content('location') ?>
Дата регистрации:content('regdate')) ?>
Рейтинг:фото 0, комментарии +1
Время у пользователя:06:22
Был на сайте:i('online')) ?> i('online')) { ?>(online)
+

+
+
Пользователей, подписанных на мои фотографии: 2

+ +

Отправить личное сообщение пользователю

+
+ + + + + +
+ +
+ + + + + \ No newline at end of file diff --git a/views/pages/Profile/LK.php b/views/pages/Profile/LK.php new file mode 100644 index 0000000..66dfcf8 --- /dev/null +++ b/views/pages/Profile/LK.php @@ -0,0 +1,45 @@ + + + + + + + + + + + + +
+ + + + + + + +
+

Общая информация

+

Здравствуйте, i('username')?>!

+

+ Количество ваших фотографий на сайте: Auth::userid()))[0]['COUNT(*)']?>

+

Всего фотографий в очереди на публикацию: 2175


+

Индекс загрузки

+

Текущее значение индекса загрузки: i('uploadindex')?>

+
+ + +
+ + +
  + +
+ + + + \ No newline at end of file