test si connecté

This commit is contained in:
Vincent TEISSIER 2024-06-03 09:53:37 +02:00
parent a91ef3e85e
commit f611f4997c
3 changed files with 10 additions and 1 deletions
application

@ -6,6 +6,7 @@ class Albums extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->model('model_music');
$this->load->library('session');
}
public function index(){
$albums = $this->model_music->getAlbums();

@ -44,6 +44,7 @@ class Connect extends CI_Controller {
public function login()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required');
@ -63,7 +64,7 @@ class Connect extends CI_Controller {
'email' => $user['email'],
'logged_in' => TRUE
]);
redirect('albums');
redirect('albums/index');
} else {
$data['error'] = 'Adresse email ou mot de passe incorrect';
$this->load->view('layout/header');

@ -1,5 +1,12 @@
<h5>Albums list</h5>
<section class="list">
<?php if ($is_logged_in): ?>
<h1>Connecté</h1>
<?php else: ?>
<h1>Non connecté</h1>
<?php endif; ?>
<?php
foreach($albums as $album){
echo "<div><article>";