Commit 95115ef4 authored by Kylian ou Nathan's avatar Kylian ou Nathan
Browse files

Up

parent ecf8f533
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -53,9 +53,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
//https://www.formget.com/form-login-codeigniter/
$route['default_controller'] = 'Accueil/showAccueil';
$route['accueil'] = 'Accueil/showAccueil';
$route['editer'] = 'Accueil/editer';
$route['default_controller'] = 'Accueil/home';
$route['accueil'] = 'Accueil/home';
$route['edit'] = 'Accueil/edit';
$route['connexion'] = 'Authentification/connexion';
$route['inscription'] = 'Authentification/inscription';
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
<?php
class Accueil extends CI_Controller {
public function __construct(){
class Accueil extends CI_Controller
{
public function __construct()
{
parent::__construct();
//$this->load->model("AccueilModele");
$this->load->model("AccueilModele");
$this->load->helper("url_helper");
}
public function showAccueil(){
//if(isset($_SESSION['email'])){
$this->load->view('accueil/accueil');
//} else {
//$this->load->view('auth/connexion');
//}
public function home()
{
//VERIFICATION QUE L'UTILISATEUR EST CONNECTE
if (!$this->session->has_userdata("email")) {
redirect('/connexion', 'refresh');
exit();
}
$this->load->view('accueil/accueil');
}
}
\ No newline at end of file
public function edit()
{
//VERIFICATION QUE L'UTILISATEUR EST CONNECTE
if (!$this->session->has_userdata("email")) {
redirect('/connexion', 'refresh');
exit();
}
$data = array();
if ($this->input->server('REQUEST_METHOD') == 'POST') {
//REQUETE HTTP POST
if ($this->input->post('nom') != null &&
$this->input->post('adresse') != null) {
$nom = $this->input->post('nom');
$adresse = $this->input->post('adresse');
// On met a jour le capteur
$this->AccueilModele->edit($nom, $adresse);
}
if ($_FILES["image"]) {
$target_file = "./static/ressources/background.jpg";
$imageFileType = strtolower(pathinfo(basename($_FILES["image"]["name"]), PATHINFO_EXTENSION));
$check = getimagesize($_FILES["image"]["tmp_name"]);
if ($check !== false && $_FILES["image"]["size"] < 500000 && ($imageFileType == "jpg" || $imageFileType == "jpeg")) {
move_uploaded_file($_FILES["image"]["tmp_name"], $target_file);
}
}
redirect("/", "refresh");
} else {
//REQUETE HTTP GET OU AUTRE
$data = $this->AccueilModele->get();
$this->load->view('accueil/edit', $data);
}
}
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment