added functions to add or change voiture

messagerie
Flavien Haas 6 years ago
parent 5d407171ae
commit 17c99d1792

@ -1,65 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="Modifier_vehicule.css" />
</head>
<body>
<div class="global bord">
<p class="fort">Modification du vehicule</p>
<form method="post" action="Liste.php">
<p>
<input name="immatriculation" type="text" placeholder="Immatriculation" class="centrage">
</p>
<p>
<input name="marque" type="text" placeholder="Marque" class="centrage" >
</p>
<p>
<input name="modele" type="text" placeholder="Modèle" class="centrage" >
</p>
<p>
<input name="annee" type="text" placeholder="Année" class="centrage" >
</p>
<p>
<input name="nombre_place" type="text" placeholder="Nombre de places" class="centrage" >
</p>
<p>
<input name="submit" type="submit" value="Valider" class="centrage">
</p>
</form>
</div>
</body>
</html>

@ -0,0 +1,63 @@
<?php
/*require ('../connectionBD.php');
$mail = null;
$db = connexionBD();
init();
*/
$matricule = $_POST['matricule'];
$marque = $_POST['marque'];
$modele = $_POST['modele'];
$nbplaces = $_POST['nbplaces'];
$anneefab = $_POST['anneefab'];
if(isset($_POST['submitadd']))
{
addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab);
}
if(isset($_POST['submitchange']))
{
changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab);
}
if(isset($_POST['submitshow']))
{
showVoiture();
}
function init(){
session_start();
global $mail;
//Si on est pas connecté redirection vers la page de connexion
if(!isset($_SESSION['mail'])){
header('Location: ../index.php');
exit();
}
else{
$mail = $_SESSION['mail'];
}
}
function addVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
//global $db;
$requete = "INSERT INTO public.voiture (matricule, marque, modele, nbplaces, anneefab, mail) VALUES ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."','mail');";
//$requete = "INSERT INTO 'public'.'voiture' ('matricule','marque','modele','nbplaces','anneefab','mail') VALUES ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."','".$_SESSION['mail']."');";
echo "requete =".$requete;
//pg_query($db, $requete);
}
function changeVoiture($matricule, $marque, $modele, $nbplaces, $anneefab){
//global $db;
$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."') WHERE mail = 'mail';";
//$requete = "UPDATE public.voiture SET (matricule, marque, modele, nbplaces, anneefab) = ('".$matricule."','".$marque."','".$modele."','".$nbplaces."','".$anneefab."') WHERE mail = '".$_SESSION['mail']."';";
echo "requete =".$requete;
//pg_query($db, $requete);
}
function showVoiture(){
//global $db;
$requete = "SELECT * FROM voiture WHERE voiture.mail = '".$_SESSION['mail']."';";
echo "requete =".$requete;
//pg_query($db, $requete);
}
?>

@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="tableauBord.css">
<link rel="icon" type="image/png" href="" />
<title>Tableau de bord</title>
<script type="text/javascript">
function ShowTab (E){
document.getElementById("addVoiture").style.display = (E == 1) ? 'block' : 'none';
document.getElementById("changeVoiture").style.display = (E == 2) ? 'block' : 'none';
document.getElementById("showVoiture").style.display = (E == 3) ? 'block' : 'none';
}
</script>
<nav class="menu">
<a class="menuItem" href="./../inscription.php">Tableau de bord</a>
<a class="menuItem" href="../inscription.php">Trajets publiés</a>
<a class="menuItem" href="../inscription.php">Trajets réservés</a>
<a class="menuItem" href="../inscription.php">Messagerie</a>
<a class="menuItem" href="../inscription.php">Avis reçus</a>
<a class="menuItem" href="../inscription.php">Avis laissés</a>
<a class="menuItem" href="../inscription.php">Profil</a>
<a class="menuItem" href="../deconnexion.php">Se déconnecter</a>
</nav>
</head>
<body>
<form id="choixFormeTestVoiture">
<div>
<input type="radio" name="TabCheck" onclick="ShowTab(1)"/>Ajouter une voiture
<input type="radio" name="TabCheck" onclick="ShowTab(2)"/>Modifier ma voiture
<input type="radio" name="TabCheck" onclick="ShowTab(3)"/>Afficher ma voiture
</div>
</form>
<div id="addVoiture" style="display: none;">
<h1>Ajouter une voiture</h1>
<fieldset>
<form action="fonctionsVoiture.php" method="post">
<table>
<tr><td><p>matricule :</p></td><td><input type="text" name="matricule"/></td></tr>
<tr><td><p>marque :</p></td><td><input type="text" name="marque"/></td></tr>
<tr><td><p>modele :</p></td><td><input type="text" name="modele"/></td></tr>
<tr><td><p>nombre de places :</p></td><td><input type="number" maxlength="1" name="nbplaces"/></td></tr>
<tr><td><p>année de fabrication :</p></td><td><input type="number" nmaxlength="4" name="anneefab"/></td></tr>
<tr><td><p><input type="submit" name="submitadd" value="ajouter une voiture"></td></tr>
</table>
</form>
</fieldset>
</div>
<div id="changeVoiture" style="display: none;">
<h1>Modifier une voiture</h1>
<fieldset>
<form action="fonctionsVoiture.php" method="post">
<table>
<tr><td><p>matricule :</p></td><td><input type="text" name="matricule"/></td></tr>
<tr><td><p>marque :</p></td><td><input type="text" name="marque"/></td></tr>
<tr><td><p>modele :</p></td><td><input type="text" name="modele"/></td></tr>
<tr><td><p>nombre de places :</p></td><td><input type="number" maxlength="1" name="nbplaces"/></td></tr>
<tr><td><p>année de fabrication :</p></td><td><input type="number" nmaxlength="4" name="anneefab"/></td></tr>
<tr><td><p><input type="submit" name="submitchange" value="modifier une voiture"></td></tr>
</table>
</form>
</fieldset>
</div>
<div id="showVoiture" style="display: none;">
<h1>Afficher ma voiture</h1>
<fieldset>
<form action="fonctionsVoiture.php" method="post">
<table>
<tr><td><p><input type="submit" name="submitshow" value="afficher ma voiture"></td></tr>
</table>
</form>
</fieldset>
</div>
</body>
</html>

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="Modifier_vehicule.css" />
</head>
<body>
<div class="global bord">
<p class="fort">Modification du vehicule</p>
<form method="post" action="Liste.php">
<p><input name="immatriculation" type="text" placeholder="Immatriculation" class="centrage"></p>
<p><input name="marque" type="text" placeholder="Marque" class="centrage"></p>
<p><input name="modele" type="text" placeholder="Modèle" class="centrage" ></p>
<p><input name="annee" type="text" placeholder="Année" class="centrage" ></p>
<p><input name="nombre_place" type="text" placeholder="Nombre de places" class="centrage"></p>
<p><input name="submit" type="submit" value="Valider" class="centrage"></p>
</form>
</div>
</body>
</html>

@ -0,0 +1,37 @@
<?php
//require ('../connectionBD.php');
//$mail = null;
//$db = connexionBD();
//init();
$matricule = isset($_POST['matricule']) ? $_POST['matricule'] : NULL; //recuperation valeur formulaire, isset pour eviter l'erreur "Notice: Undefined index"
$marque = isset($_POST['marque']) ? $_POST['marque'] : NULL;
$modele = isset($_POST['modele']) ? $_POST['modele'] : NULL;
$nbplaces = isset($_POST['nbplaces']) ? $_POST['nbplaces'] : NULL;
$anneefab = isset($_POST['anneefab']) ? $_POST['anneefab'] : NULL;
if(isset($_POST['submit']))
{
addVoiture();
}
function init(){
session_start();
global $mail;
//Si on est pas connecté redirection vers la page de connexion
if(!isset($_SESSION['mail'])){
header('Location: ../index.php');
exit();
}
else{
$mail = $_SESSION['mail'];
}
}
function addVoiture(){
//global $db;
$requete = "INSERT INTO "public"."voiture" ("matricule","marque","modele","nbplaces","anneefab","mail") VALUES ('"global $matricule"','"global $marque"','"global $modele"','"global $nbplaces"','"global $anneefab"','"$_SESSION['mail']"');";
echo "requete =".$requete;
//pg_query($db, $requete);
}
?>

@ -0,0 +1,39 @@
<?php
//require ('../connectionBD.php');
//$mail = null;
//$db = connexionBD();
//init();
$matricule = isset($_POST['matricule']) ? $_POST['matricule'] : NULL; //recuperation valeur formulaire, isset pour eviter l'erreur "Notice: Undefined index"
$marque = isset($_POST['marque']) ? $_POST['marque'] : NULL;
$modele = isset($_POST['modele']) ? $_POST['modele'] : NULL;
$nbplaces = isset($_POST['nbplaces']) ? $_POST['nbplaces'] : NULL;
$anneefab = isset($_POST['anneefab']) ? $_POST['anneefab'] : NULL;
if(isset($_POST['submit']))
{
changeVoiture();
}
function init(){
session_start();
global $mail;
//Si on est pas connecté redirection vers la page de connexion
if(!isset($_SESSION['mail'])){
header('Location: ../index.php');
exit();
}
else{
$mail = $_SESSION['mail'];
}
}
function changeVoiture(){
//global $db;
$requete = "UPDATE 'public'.'voiture' SET ('matricule','marque','modele','nbplaces','anneefab') = ('"$_POST['matricule']"','"$_POST['marque']"','"$_POST['modele']"','"$_POST['nbplace']"','"$_POST['anneefab']"') WHERE mail = 'mail';";
//$requete = "UPDATE 'public'.'voiture' SET ('matricule','marque','modele','nbplaces','anneefab') = ('"$matricule"','"$marque"','"$modele"','"$nbplaces"','"$anneefab"') WHERE mail = '"$_SESSION['mail']"';";
echo "requete =".$requete;
//pg_query($db, $requete);
}
?>

@ -0,0 +1,31 @@
<?php
//require ('../connectionBD.php');
//$mail = null;
//$db = connexionBD();
//init();
if(isset($_POST['submit']))
{
showVoiture();
}
function init(){
session_start();
global $mail;
//Si on est pas connecté redirection vers la page de connexion
if(!isset($_SESSION['mail'])){
header('Location: ../index.php');
exit();
}
else{
$mail = $_SESSION['mail'];
}
}
function showVoiture(){
//global $db;
$requete = "UPDATE 'public'.'voiture' SET ('matricule','marque','modele','nbplaces','anneefab') = ('"global $matricule"','"global $marque"','"global $modele"','"global $nbplaces"','"global $anneefab"') WHERE mail = "$_SESSION['mail']";";
echo "requete =".$requete;
//pg_query($db, $requete);
}
?>

@ -0,0 +1,128 @@
*{
margin: 0;
padding: 0;
font-family: "Calibri Light";
}
h1{
font-size: 3em;
text-align: center;
text-decoration: underline;
}
#content{
min-width: 320px;
width: 100%;
display: flex;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
}
#tableauBord{
margin: 2em;
padding: 1em;
width: 100%;
}
.menu {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
background-color: rgb(65, 154, 28);
}
.menuItem {
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
color: white;
width: 10%;
min-width: 5em;
font-weight: bold;
text-decoration: none;
padding: 0.8em;
border-bottom: 4px solid rgb(65, 154, 28);
font-size: 1.1em;
text-align: center;
}
.menuItem:hover{
cursor: pointer;
border-bottom: 4px solid orange;
}
#divImgProfil{
width: 100%;
display: flex;
flex-wrap: nowrap;
justify-content: center;
}
#imgProfil{
background-color: white;
margin-top: 2.5em;
width: 60%;
height: 60%;
max-width: 210px;
max-height: 210px;
border-radius: 10px;
}
#trajet{
margin-top: 2em;
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: center;
text-align: center;
width: 100%;
}
.btnTrajet{
display: flex;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
text-decoration: none;
padding: 0.4em;
color: black;
background-color: lightgray;
border: 1px solid black;
}
.btnTrajet:hover{
background-color: grey;
}
#btnTrajet2{
margin-left: 10%;
}
#recap{
margin-top: 2.5em;
width: 50%;
margin-left: 50%;
transform: translate(-50%);
}
.recapLine{
margin-bottom: 1.5em;
display: flex;
flex-wrap: nowrap;
justify-content: left;
align-items: center;
width: 100%;
}
.recapIcon{
width: 50px;
height: 50px;
}
p{
margin-left: 10%;
}
Loading…
Cancel
Save