MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/sb_web/b744/hotelelila.com/chantier/
File Upload :
Current < : /hermes/sb_web/b744/hotelelila.com/chantier/fonction.php

<?php
try{
	$bd=new PDO('mysql:host=localhost;dbname=ulb_suivi_construction;SET CHARACTER SET utf-8','root','',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
	$bd->exec('SET CHARACTER SET UTF8');
}
catch(Exception $e)
{
	$d = new PDO("mysql:host=localhost", 'root',''); $d->exec("CREATE DATABASE IF NOT EXISTS ulb_suivi_construction CHARACTER SET utf8 COLLATE utf8_general_ci");
	
	$bd=new PDO('mysql:host=localhost;dbname=ulb_suivi_construction;SET CHARACTER SET utf-8','root','',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
	$bd->exec('SET CHARACTER SET UTF8');
}
// TABLE
$bd->exec("CREATE TABLE IF NOT EXISTS user (username varchar(30) NOT NULL,nom_complet text NOT NULL,mail text NOT NULL,password varchar(30) NOT NULL, type_user varchar(20) NOT NULL, photo text NOT NULL, date_creation datetime NOT NULL, save_by varchar(30) NOT NULL, PRIMARY KEY (username)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ");

$bd->exec("CREATE TABLE IF NOT EXISTS projet (code_projet int(11) NOT NULL AUTO_INCREMENT,nom_projet text NOT NULL, debut date NOT NULL,fin date NOT NULL, logo text NOT NULL, bailleur text NOT NULL, add_by varchar(30) NOT NULL, PRIMARY KEY (code_projet)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS chantier (code_chantier int(11) NOT NULL AUTO_INCREMENT, ref varchar(50) NOT NULL, intitule text NOT NULL, entreprise text NOT NULL, date_debut date NOT NULL, date_fin date NOT NULL, dpo varchar(30) NOT NULL,code_projet int(11) NOT NULL, save_by varchar(30) NOT NULL, save_date datetime NOT NULL, PRIMARY KEY (code_chantier)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS devis (code_devis int(11) NOT NULL AUTO_INCREMENT, numero_devis int(11) NOT NULL, designation text NOT NULL, unite varchar(20) NOT NULL, quantite float(9,2) NOT NULL, prix_unit float(10,2) NOT NULL, prix_total float(11,2) NOT NULL, creation_date datetime NOT NULL, code_rubrique int(11) NOT NULL, code_chantier int(11) NOT NULL, creation_by varchar(30) NOT NULL, PRIMARY KEY (code_devis)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS rubrique (code_rubrique int(11) NOT NULL AUTO_INCREMENT,numero_rubrique int(11) NOT NULL, nom_rubrique text NOT NULL,code_chantier int NOT NULL, date_ajout datetime NOT NULL, ajout_by varchar(30) NOT NULL, PRIMARY KEY (code_rubrique)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS rapport_journalier (code_journ int(11) NOT NULL AUTO_INCREMENT, date_journ date NOT NULL, nbre_feminin_rh int(11) NOT NULL, nbre_masculin_rh int(11) NOT NULL, heure_travail text NOT NULL, heure_suspension text NOT NULL, heure_effectives float(5,2) NOT NULL, etat_atm text NOT NULL, observation test NOT NULL, fait_le datetime NOT NULL, fait_par varchar(30) NOT NULL, code_devis int(11) NOT NULL, PRIMARY KEY (code_journ)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS ressource_humaine (code_rh varchar(30) NOT NULL,statut_rh text NOT NULL,nbre_rh text NOT NULL,present text NOT NULL, absents text NOT NULL, code_rapport int(11) NOT NULL, date_creation datetime NOT NULL, save_by varchar(30) NOT NULL, PRIMARY KEY (code_rh)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ");

$bd->exec("CREATE TABLE IF NOT EXISTS ressource_materielle (code_rm int(11) NOT NULL AUTO_INCREMENT, designation_rm text NOT NULL, unite_rm varchar(20) NOT NULL, etat_rm varchar(20) NOT NULL, a_servis_rm varchar(20) NOT NULL, code_rapport int(11) NOT NULL, save_by varchar(30) NOT NULL, PRIMARY KEY (code_rm)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS etat_stock (code_es int(11) NOT NULL AUTO_INCREMENT, designation_es text NOT NULL, unite_es varchar(20) NOT NULL, qte_utilise float(10,2) NOT NULL, qte_aprovisionee float(10,2) NOT NULL, qte_dispo float(10,2) NOT NULL, besoin_es text NOT NULL, code_rapport int(11) NOT NULL, save_by varchar(30) NOT NULL, PRIMARY KEY (code_es)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS travaux_effectues (code_te int(11) NOT NULL AUTO_INCREMENT, unite_te int(11) NOT NULL, qte_devis float(10,2) NOT NULL, qte_cumule float(10,2) NOT NULL, qte_prevue float(10,2) NOT NULL, qte_realisee float(10,2) NOT NULL, fait_par varchar(30) NOT NULL, code_rapport int(11) NOT NULL, PRIMARY KEY (code_te)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS rapport_hebdo (code_hebdo int(11) NOT NULL AUTO_INCREMENT,nom_organisation text NOT NULL, PRIMARY KEY (code_hebdo)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

$bd->exec("CREATE TABLE IF NOT EXISTS decompte (code_decompte int(11) NOT NULL AUTO_INCREMENT, last_update datetime NOT NULL, PRIMARY KEY (code_decompte)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ");

// $bd->exec("ALTER TABLE booking CHANGE code_book code_book INT(11) NOT NULL"); $bd->exec("ALTER TABLE booking DROP PRIMARY KEY(code_book)");$bd->exec("ALTER TABLE booking  ADD id_booking INT NOT NULL AUTO_INCREMENT FIRST"); 
?>