mirror of
https://grond.iut-fbleau.fr/stiti/SAE_2.02
synced 2024-12-27 01:12:18 +01:00
Ajout de sécurité
This commit is contained in:
parent
283fae5d6b
commit
becd86a661
@ -24,12 +24,20 @@ class Albums extends CI_Controller {
|
||||
$albums = $this->model_music->getAlbums($limit, $offset, $order_by, $genre_id, $artist_id);
|
||||
$total_albums = $this->model_music->get_total_albums($genre_id, $artist_id);
|
||||
|
||||
$total_pages = ceil($total_albums / $limit);
|
||||
|
||||
// Vérifier si la page demandée est valide
|
||||
if ($page < 1 || $page > $total_pages) {
|
||||
redirect('errors/error_404');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->session->userdata('user_id')) {
|
||||
$user_id = $this->session->userdata('user_id');
|
||||
$data['user_playlists'] = $this->Model_playlist->get_user_playlists($user_id);
|
||||
}
|
||||
|
||||
$data['total_pages'] = ceil($total_albums / $limit);
|
||||
$data['total_pages'] = $total_pages;
|
||||
$data['current_page'] = $page;
|
||||
$data['albums'] = $albums;
|
||||
$data['order_by'] = $order_by;
|
||||
|
@ -29,6 +29,12 @@ class Musiques extends CI_Controller {
|
||||
$total_musiques = $this->Model_music->get_total_musiques();
|
||||
$total_pages = ceil($total_musiques / $limit);
|
||||
|
||||
// Vérifier si la page demandée est valide
|
||||
if ($page < 1 || $page > $total_pages) {
|
||||
redirect('errors/error_404');
|
||||
return;
|
||||
}
|
||||
|
||||
$current_page = $page;
|
||||
$genres = $this->Model_music->getGenres();
|
||||
$artists = $this->Model_music->getArtists();
|
||||
|
Loading…
Reference in New Issue
Block a user