49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class InscriptionController extends CI_Controller {
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
$this->load->helper(array('url', 'html'));
|
|
}
|
|
|
|
public function inscription() {
|
|
$this->load->view('layout/header');
|
|
$this->load->view('connexion');
|
|
$this->load->view('layout/footer');
|
|
}
|
|
|
|
public function traitement() {
|
|
if(isset($_POST['ok'])){
|
|
$this->load->database();
|
|
|
|
|
|
$prenom = ucfirst(strtolower($this->input->post('prenom')));
|
|
$nom = strtoupper($this->input->post('nom'));
|
|
$pseudo = $this->input->post('pseudo');
|
|
$mdp = $this->input->post('pass');
|
|
$mdpcrypte = password_hash($mdp, PASSWORD_DEFAULT);
|
|
$email = $this->input->post('email');
|
|
|
|
$data = array(
|
|
'pseudo' => $pseudo,
|
|
'nom' => $nom,
|
|
'prenom' => $prenom,
|
|
'mdp' => $mdpcrypte,
|
|
'email' => $email
|
|
);
|
|
|
|
$this->db->insert('users', $data);
|
|
|
|
$data['confirmation_message'] = "Inscription réussie ! Vous êtes maintenant inscrit.";
|
|
|
|
$this->load->view('layout/header');
|
|
$this->load->view('connexion', $data);
|
|
$this->load->view('layout/footer');
|
|
}
|
|
}
|
|
|
|
|
|
}
|