Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8b9d70e
NEW FILE MODEL FOR ACCOUNT USER
elviskankola1 Nov 30, 2018
950ce12
NEW FUNCTION FOR SIGN IN USER IN MODEL COMPTE_MODEL
elviskankola1 Nov 30, 2018
a3e13e2
ADDING COMMENT'S FOR MORE COMPREHENSION'S
elviskankola1 Nov 30, 2018
6b667fc
NEW COMMENT'S
elviskankola1 Nov 30, 2018
b9aaf49
COMMENT
elviskankola1 Nov 30, 2018
983192f
NEW FUNCTION FOR CREATE THE ACCOUNT FOR USER
elviskankola1 Nov 30, 2018
981cecb
AUTOLOADING FOR MODEL compte_model
elviskankola1 Nov 30, 2018
ad50f6c
AUTOLOADING FOR ONE HELPER AND LIBRARY
elviskankola1 Nov 30, 2018
ae29a87
NEW FUNCTION INDEX IN CONTROLLERS FOLDER/MOkapi.php
elviskankola1 Nov 30, 2018
f2eed84
UPDATE ONE FUNCTION
elviskankola1 Nov 30, 2018
ab88ebe
UPDATE FUNCTION INDEX IN CONTROLLER FOLDER
elviskankola1 Nov 30, 2018
e8000e2
SETTING DATABASE
elviskankola1 Nov 30, 2018
9c1a226
WRITTING OF FIELDS DATABASE IN ALL ACTIONS MODEL/compte_model
elviskankola1 Nov 30, 2018
a133951
LOADING OF VIEW mokapi_home in controller
elviskankola1 Nov 30, 2018
dc323be
AUTOLODING OF ONE LIBRABRY IN CONFIG FOLDER/autoload.php
elviskankola1 Nov 30, 2018
2d0def8
configiration of my config file in CONFIG/config.php
elviskankola1 Nov 30, 2018
0273d3e
REWRITTING NAME OF CONTROLLER
elviskankola1 Nov 30, 2018
3f8dfba
NEW FUNCTION FOR LOG IN CONTROLLERS FOLDER / MOkapi.php
elviskankola1 Nov 30, 2018
33c41f5
UPDATE FOR SOME QUERY IN FUNCTION'S
elviskankola1 Nov 30, 2018
85afedf
CREATING FOR NEW FORM
elviskankola1 Nov 30, 2018
32a981a
COMMENT IN CONTROLLER
elviskankola1 Nov 30, 2018
133b119
UPDATE Login_In_Account
elviskankola1 Nov 30, 2018
12ba3be
UPDATE
elviskankola1 Nov 30, 2018
f08a4e2
UPDATE
elviskankola1 Nov 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions application/config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array();
$autoload['libraries'] = array('database');

/*
| -------------------------------------------------------------------
Expand Down Expand Up @@ -89,7 +89,7 @@
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array();
$autoload['helper'] = array('form','url');

/*
| -------------------------------------------------------------------
Expand Down Expand Up @@ -132,4 +132,4 @@
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();
$autoload['model'] = array('compte_model');
2 changes: 1 addition & 1 deletion application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = 'http://localhost:1024/m-okapi/';
$config['base_url'] = 'http://localhost/m-okapi/';

/*
|--------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions application/config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'username' => 'root',
'password' => '',
'database' => '',
'database' => 'mokapi',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
Expand Down
2 changes: 1 addition & 1 deletion application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'mokapi';
$route['default_controller'] = 'MOkapi';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
65 changes: 59 additions & 6 deletions application/controllers/MOkapi.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,63 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class MOkapi extends CI_Controller
{
public function index()
{
$this->load->view('mokapi_home.php');
class MOkapi extends CI_Controller{

/*=============================================================================
ICI LE CONSTRUCTEUR DE LA CALSS
===============================================================================*/
function __construct(){
parent::__construct();
}
/*=============================================================================
ICI ACTION DE LA CLASSE REPRESENTANT DE LA MAIN PAGE
===============================================================================*/
public function index(){
$this->load->view('user/main');
}
public function form_inscription(){
$this->load->view('user/mokapi_home');
}
public function form_auth(){
$this->load->view('user/auth');
}
/*=============================================================================
ICI L'ACTION DE CREATION D'UN COMPTE
===============================================================================*/

public function Create_Account(){

$name_user = strip_tags($this->input->post('nom'));
$email_user = strip_tags($this->input->post('email'));
$pseudo_user = strip_tags($this->input->post('pseudo'));
$pass_user = $this->input->post('pwd');
$confirm_pass_user = $this->input->post('pwdc');
if ($pass_user == $confirm_pass_user && filter_var($email_user,FILTER_VALIDATE_EMAIL)) {
$verify_user_exist = $this->compte_model->Sign_In_User($pseudo_user,$pass_user);
if ($verify_user_exist == false) {

$this->compte_model->Create_Account_User($name_user,$email_user, $pseudo_user, $pass_user);
echo "VOUS AVEZ CREE UN COMPTE ET BIENVENU CHEZ NOUS!";
}
}else{
redirect($_SERVER['HTTP_REFERER']);
}
}

/*=============================================================================
ICI L'ACTION DE SE LOGER
===============================================================================*/
public function Login_In_Account(){

$pseudo_user = strip_tags($this->input->post('pseudo'));
$pass_user = $this->input->post('pwd');
$user = $this->compte_model->Sign_In_User($pseudo_user,$pass_user);
if($user){
echo "vous etes bien sur votre compte!";
}else{
redirect($_SERVER['HTTP_REFERER']);
}
}
}
}


44 changes: 44 additions & 0 deletions application/models/Compte_model.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Compte_model extends CI_Model {

/*=============================================================================
ICI LES ATTRIBUTS DE LA CLASSE REPRESENTANT DE TABLE DE LA DB
===============================================================================*/
private $table_user = 'utilisateur';
/*=============================================================================
ICI LE CONSTRUCTEUR DE LA CLASSE
===============================================================================*/
function __construct(){
parent::__construct();
}
/*=============================================================================
ICI L' ACTION DE CREATION DU COMPTE
===============================================================================*/
public function Create_Account_User($nom_user, $pseudo_user,$email_user, $password_user){

$this->db->set('nomcomplet',$nom_user);
$this->db->set('login',$pseudo_user);
$this->db->set('email',$email_user);
$this->db->set('mdp',$password_user);
$this->db->set('etat',1);
return $this->db->insert($this->table_user);

}
/*=============================================================================
ICI L' ACTION DE SE LOGER
===============================================================================*/
public function Sign_In_User($login ='', $pass =''){

$query = $this->db->where(['login'=>$login,'mdp'=>$pass])->get($this->table_user)->result();
if( $query == true){
return true;
}else{
return false;
}
}


}
17 changes: 0 additions & 17 deletions application/views/mokapi_home.php

This file was deleted.

11 changes: 11 additions & 0 deletions application/views/user/auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<h1>AUTHENTIFICATION</h1>
<form method ="post" action ="<?php echo site_url('MOkapi/Login_In_Account');?>">
<input type="text" class="form-control" placeholder="entez votre pseudo" name="pseudo">
<input type="password" class="form-control" placeholder="votre password" name="pwd">
<button class="btn btn-primary">LOGIN</button></fieldset>
</form>
<hr>
<a href ="<?php echo site_url();?>"> <button>ACCUEIL</button></a>
15 changes: 15 additions & 0 deletions application/views/user/main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>

</head>
<body>
<h1>BIENVENUE SUR M-OKAPI</h1>
<em> votre gestionnaire de budgets</em><br><br><br><br><br>
<a href ="<?php echo site_url('MOkapi/form_inscription');?>"> <button>CREER UN COMPTE</button></a>
<a href ="<?php echo site_url('MOkapi/form_auth');?>"> <button>SE CONNECTER</button></a>
</body>
</html>
12 changes: 12 additions & 0 deletions application/views/user/mokapi_home.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<h1>CREER UN COMPTE</h1>
<form method ="post" action ="<?php echo site_url('MOkapi/Create_Account');?>">
<input type="text" class="form-control" placeholder="entez votre nom" name="nom">
<input type="email" class="form-control" placeholder="exemple@domaine.com" name="email">
<input type="text" class="form-control" placeholder="entrez votre pseudo" name="pseudo">
<input type="password" class="form-control" placeholder="entez votre pwd" name="pwd">
<input type="password" class="form-control" placeholder="confirmez pwd" name="pwdc">
<button class="btn btn-primary">CREATE</button></fieldset>
</form>