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 @@ + + + + +
+ + + + + + + + +
+ Общая информация+Здравствуйте, =$user->i('username')?>!++ Количество ваших фотографий на сайте: =DB::query('SELECT COUNT(*) FROM photos WHERE user_id=:uid', array(':uid'=>Auth::userid()))[0]['COUNT(*)']?> +Всего фотографий в очереди на публикацию: 2175 + Индекс загрузки+Текущее значение индекса загрузки: =$user->i('uploadindex')?> ++ + + + + + + + |
+