mirror of
https://grond.iut-fbleau.fr/stiti/SAE_2.02
synced 2024-11-09 21:11:40 +01:00
Ajout de l'inscription
This commit is contained in:
parent
53b4895d89
commit
40a7dd1979
@ -387,7 +387,7 @@ $config['sess_driver'] = 'files';
|
|||||||
$config['sess_cookie_name'] = 'ci_session';
|
$config['sess_cookie_name'] = 'ci_session';
|
||||||
$config['sess_samesite'] = 'Lax';
|
$config['sess_samesite'] = 'Lax';
|
||||||
$config['sess_expiration'] = 7200;
|
$config['sess_expiration'] = 7200;
|
||||||
$config['sess_save_path'] = NULL;
|
$config['sess_save_path'] = sys_get_temp_dir(); // Utiliser le répertoire temporaire du système
|
||||||
$config['sess_match_ip'] = FALSE;
|
$config['sess_match_ip'] = FALSE;
|
||||||
$config['sess_time_to_update'] = 300;
|
$config['sess_time_to_update'] = 300;
|
||||||
$config['sess_regenerate_destroy'] = FALSE;
|
$config['sess_regenerate_destroy'] = FALSE;
|
||||||
|
46
CodeIgniter-3.1.13/application/controllers/Utilisateur.php
Normal file
46
CodeIgniter-3.1.13/application/controllers/Utilisateur.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Utilisateur extends CI_Controller {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->helper(array('form', 'url'));
|
||||||
|
$this->load->library(array('form_validation', 'session'));
|
||||||
|
$this->load->model('Utilisateur_model');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function inscription(){
|
||||||
|
// Définir les règles de validation
|
||||||
|
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[utilisateur.email]');
|
||||||
|
$this->form_validation->set_rules('nom', 'Nom', 'required');
|
||||||
|
$this->form_validation->set_rules('prenom', 'Prénom', 'required');
|
||||||
|
$this->form_validation->set_rules('telephone', 'Téléphone', 'max_length[20]');
|
||||||
|
|
||||||
|
if ($this->form_validation->run() == FALSE) {
|
||||||
|
// Charger la vue avec les erreurs
|
||||||
|
$this->load->view('layout/header_not_logged_dark');
|
||||||
|
$this->load->view('inscription');
|
||||||
|
$this->load->view('layout/footer_dark');
|
||||||
|
} else {
|
||||||
|
// Récupérer les données du formulaire
|
||||||
|
$data = array(
|
||||||
|
'email' => $this->input->post('email'),
|
||||||
|
'nom' => $this->input->post('nom'),
|
||||||
|
'prenom' => $this->input->post('prenom'),
|
||||||
|
'telephone' => $this->input->post('telephone')
|
||||||
|
);
|
||||||
|
|
||||||
|
// Insérer les données dans la base de données
|
||||||
|
if ($this->Utilisateur_model->insert_user($data)) {
|
||||||
|
$this->session->set_flashdata('success', 'Inscription réussie. Vous pouvez maintenant vous connecter.');
|
||||||
|
redirect('utilisateur/inscription');
|
||||||
|
} else {
|
||||||
|
$data['error'] = 'Une erreur est survenue. Veuillez réessayer.';
|
||||||
|
$this->load->view('layout/header_not_logged_dark');
|
||||||
|
$this->load->view('inscription', $data);
|
||||||
|
$this->load->view('layout/footer_dark');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
CodeIgniter-3.1.13/application/models/Utilisateur_model.php
Normal file
14
CodeIgniter-3.1.13/application/models/Utilisateur_model.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Utilisateur_model extends CI_Model {
|
||||||
|
|
||||||
|
public function __construct(){
|
||||||
|
parent::__construct();
|
||||||
|
$this->load->database();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insert_user($data){
|
||||||
|
return $this->db->insert('utilisateur', $data);
|
||||||
|
}
|
||||||
|
}
|
47
CodeIgniter-3.1.13/application/views/inscription.php
Normal file
47
CodeIgniter-3.1.13/application/views/inscription.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Inscription</title>
|
||||||
|
<link rel="stylesheet" href="<?php echo base_url('assets/css/inscription.css'); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h2>Inscription</h2>
|
||||||
|
|
||||||
|
<?php if (isset($error)): ?>
|
||||||
|
<p class="error"><?php echo $error; ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php echo form_open('utilisateur/inscription'); ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="email">Email :</label>
|
||||||
|
<input type="email" name="email" id="email" value="<?php echo set_value('email'); ?>" required>
|
||||||
|
<?php echo form_error('email'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="nom">Nom :</label>
|
||||||
|
<input type="text" name="nom" id="nom" value="<?php echo set_value('nom'); ?>" required>
|
||||||
|
<?php echo form_error('nom'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="prenom">Prénom :</label>
|
||||||
|
<input type="text" name="prenom" id="prenom" value="<?php echo set_value('prenom'); ?>" required>
|
||||||
|
<?php echo form_error('prenom'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="telephone">Téléphone :</label>
|
||||||
|
<input type="text" name="telephone" id="telephone" value="<?php echo set_value('telephone'); ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn-submit">Inscription</button>
|
||||||
|
|
||||||
|
<?php echo form_close(); ?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -29,7 +29,7 @@
|
|||||||
<a href="<?php echo site_url('artiste/list_artists'); ?>" class="btn-artistes">Artistes</a>
|
<a href="<?php echo site_url('artiste/list_artists'); ?>" class="btn-artistes">Artistes</a>
|
||||||
<a href="<?php echo site_url('musiques'); ?>" class="btn-musiques">Musiques</a>
|
<a href="<?php echo site_url('musiques'); ?>" class="btn-musiques">Musiques</a>
|
||||||
<a href="#CONNEXIONBIENTOT" class="btn-connexion">Connexion</a>
|
<a href="#CONNEXIONBIENTOT" class="btn-connexion">Connexion</a>
|
||||||
<a href="#INSCRIPTIONBIENTOT" class="btn-inscription">Inscription</a>
|
<a href="<?php echo site_url('utilisateur/inscription'); ?>" class="btn-inscription">Inscription</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="menu-toggle">
|
<div class="menu-toggle">
|
||||||
|
62
CodeIgniter-3.1.13/assets/css/inscription.css
Normal file
62
CodeIgniter-3.1.13/assets/css/inscription.css
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 500px;
|
||||||
|
margin: 50px auto;
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
text-align: center;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#email,
|
||||||
|
#nom,
|
||||||
|
#prenom,
|
||||||
|
#telephone,
|
||||||
|
button {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-submit {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #634caf;
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-submit:hover {
|
||||||
|
background-color: rgb(54, 16, 119);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
color: red;
|
||||||
|
margin-top: 5px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user