diff --git a/app/Controllers/MainController.php b/app/Controllers/MainController.php index b622d79..f7daa7c 100644 --- a/app/Controllers/MainController.php +++ b/app/Controllers/MainController.php @@ -31,6 +31,11 @@ class MainController { Page::set('Update'); + } + public static function top30() + { + Page::set('Top30'); + } public static function logout() diff --git a/app/Core/Routes.php b/app/Core/Routes.php index aa6dc1e..97c7915 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -21,6 +21,7 @@ class Routes Router::get('/about', 'MainController@about'); Router::get('/rules', 'MainController@rules'); Router::get('/update', 'MainController@update'); + Router::get('/top30', 'MainController@top30'); diff --git a/views/pages/Main.php b/views/pages/Main.php index 2d0a6c0..873dcd6 100644 --- a/views/pages/Main.php +++ b/views/pages/Main.php @@ -61,7 +61,7 @@ use App\Models\{User, Vote, Comment};
+ 30 самых просматриваемых фото за 24 часа+
+ = UNIX_TIMESTAMP(NOW()) - 86400
+GROUP BY photo_id
+ORDER BY view_count DESC
+LIMIT 30;');
+$top = 0;
+foreach ($photos as $pd) {
+
+ $photo = DB::query('SELECT * FROM photos WHERE id=:id', array(':id'=>$pd['photo_id']));
+ foreach ($photo as $p) {
+ $top++;
+ $author = new User($p['user_id']);
+ echo '
+
+ ';
+
+}
+}
+ ?>
+
+
+
|
+ |||