diff --git a/Accueil_paiement.php b/Accueil_paiement.php new file mode 100644 index 0000000000000000000000000000000000000000..b19b3fc737aad3820110a85bc48cd41c2f110eba --- /dev/null +++ b/Accueil_paiement.php @@ -0,0 +1,48 @@ +<?php + + include("Module.php"); + + En_Tete_Site("Page de paiement"); + + Titre_Site("Bienvenue sur la page de paiement"); + + +?> + + <p>Bonjour <?php echo $prenom,$nom?>. Bienvenue sur l'espace de paiement. Veuillez renseigner vos coordonnées bancaires : <br/><br/> + + <img src="imag/logo-carte-bleue.jpg" width="140" height="120" alt="Carte Bleue" /> + </p> + + <form action="Paiement.php" method="post"> + + <p><br/>Votre numéro de carte bancaire (à 16 chiffres): <input type="text" name="NBCB" size="16" maxlength="16"/></p> + + <p>La date d'expiration : + +<?php + + print '<select name="choix">'; + + for ($i = 16; $i <= 20; $i++) { + for ($j = 1; $j <= 12; $j++) { + echo '<option value="choix1">',$j,'/',$i,'</option>'; + } + + } + + print '</select></p>'; + +?> + + <p>Cryptogramme : <input type="text" name="Cryptogramme" size=2 /></p> + + <p><input type="submit" value="Valider"></p> + + </form> + +<? + + Pied(); + +?> diff --git a/Annuler.php b/Annuler.php new file mode 100644 index 0000000000000000000000000000000000000000..bed386c77f473944289c399ab56f1f7d616c9ee5 --- /dev/null +++ b/Annuler.php @@ -0,0 +1,19 @@ +<?php + + include("Module.php"); + + En_Tete_Site("Page de paiement"); + + print "<body>\n"; + + session_start(); + + print "<p>Au revoir.</p>"; + + session_destroy(); + + print "<p><a href='home_new.php'>Retour à la page d'accueil</a></p>"; + + Pied(); + +?> \ No newline at end of file diff --git a/Captain-America-Civil-War-banner-101.jpg b/Captain-America-Civil-War-banner-101.jpg deleted file mode 100644 index 74a5b663717ecf3be4fc5885102245be852c1360..0000000000000000000000000000000000000000 Binary files a/Captain-America-Civil-War-banner-101.jpg and /dev/null differ diff --git a/Miseenpage.php b/Miseenpage.php deleted file mode 100644 index 3ef66a59ace5f519b42dc3f3ba748330c99b2a45..0000000000000000000000000000000000000000 --- a/Miseenpage.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -function enTete($titre) -{ - print "<!DOCTYPE html>\n"; - print "<html>\n"; - print "<head>\n"; - print "<meta charset=\"utf-8\" />\n"; - print "<title>$titre</title>\n"; - print "<link rel=\"stylesheet\" href=\"style.css\"/>\n"; - print "</head>\n"; - - print "<body>\n"; - print "<h1> $titre </h1>\n"; -} - -function pied(){ - print "</body>\n"; - print "</html>\n"; - -} - -?> \ No newline at end of file diff --git a/Miseenpage_paiement.php b/Module.php similarity index 58% rename from Miseenpage_paiement.php rename to Module.php index 7478d6693a1404af8655ff2fd16701c7fb8ef314..6c07c483dd791dd00051b92e53476c52cfec070a 100644 --- a/Miseenpage_paiement.php +++ b/Module.php @@ -1,6 +1,6 @@ <?php -function EnTeteSite($titre) +function En_Tete_Site($titre) { print "<!DOCTYPE html>\n"; @@ -13,7 +13,7 @@ function EnTeteSite($titre) } -function TitreSite($titre) +function Titre_Site($titre) { print "<body>\n"; @@ -21,7 +21,7 @@ function TitreSite($titre) } -function pied() +function Pied() { print "</body>\n"; @@ -29,4 +29,14 @@ function pied() } -?> + +function Retour_Au_Menu() +{ + + print "<a href=\"Accueil_paiement.php\">Retour à la page de paiement</a> <br/><br/>"; + print "<a href=\"Annuler.php\">Annuler la réservation</a>"; + +} + + +?> \ No newline at end of file diff --git a/Paiement.php b/Paiement.php index 968f2093432f852c5eec01aa71a052609300748f..ad2a56ecc9d4fbf7ed981d884ad0cec0f3f0afa0 100644 --- a/Paiement.php +++ b/Paiement.php @@ -1,11 +1,28 @@ <?php - include("Miseenpage_paiement.php"); + include("Module.php"); - EnTeteSite("Page de paiement"); - - TitreSite("Bienvenue a paiement!"); + En_Tete_Site("Page de paiement"); - pied(); + print "<body>\n"; -?> +// Le mot de passe n'a pas été envoyé ou n'est pas bon +if (!isset($_POST['NBCB']) OR strlen($_POST['NBCB']) != 16) +{ + print 'Vous n\'avez pas saisi les 16 chiffres de votre carte bancaire. <br/><br/>'; Retour_Au_Menu(); +} +else if (!isset($_POST['Cryptogramme']) OR strlen($_POST['Cryptogramme']) != 3) +{ + print 'Vous n\'avez pas saisi les 3 chiffres de votre cryptogramme. <br/><br/>'; Retour_Au_Menu(); +} +else +{ + print 'Les coordonnées de la carte bancaire sont correctes. Nous attendons l\'autorisation de votre banque...'; + + header('Refresh: 5; url=Remerciement.php'); + ob_flush(); +} + + Pied(); + +?> \ No newline at end of file diff --git a/Remerciement.php b/Remerciement.php new file mode 100644 index 0000000000000000000000000000000000000000..468072f54e93e34d544d78ec7b26030f59643426 --- /dev/null +++ b/Remerciement.php @@ -0,0 +1,16 @@ +<?php + + include("Module.php"); + + En_Tete_Site("Page de paiement"); + + print "<body>\n"; + + print "<p>Votre paiement a été accepté ! <br/><br/> Vous serez redirigé vers la page d'accueil !</p>"; + + header('Refresh: 5; url=home_new.php'); + ob_flush(); + + Pied(); + +?> \ No newline at end of file diff --git a/Style.css b/Style.css new file mode 100644 index 0000000000000000000000000000000000000000..b0c6c33574b0e29d6444e8fb6b7dd31e410c896f --- /dev/null +++ b/Style.css @@ -0,0 +1,17 @@ +body { + background-color: #d0e4fe; +} + +h1 { + font-family: "Times New Roman"; + font-size: 40px; + color: Black; + text-align: center; +} + +p { + font-family: "Times New Roman"; + font-size: 25px; + color: red; + text-align: center; +} \ No newline at end of file diff --git a/choix.php b/choix.php new file mode 100644 index 0000000000000000000000000000000000000000..2fa507540e544b5e53a840909a32f13133edc58a --- /dev/null +++ b/choix.php @@ -0,0 +1,118 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>page des choix </title> + <link rel="stylesheet" type="text/css" href="style_home.css" /> + </head> + + <body bgcolor="#808080"> + + <!-- L'en-tête --> + <div class="container"> + <table> + <col width="100"/> + <col width="1000"/> + <tr> + <td><a href="#"><img src="imag/opera_logo.jpg" /></a></td> + <td align="center"><h1><font color="#808080">Hall Welcomes <?php session_start();echo $_SESSION['login'];?></font></h1></td> + <td align="right"><font color="red"><a href="home.html" title ="deconnection">disconnect</a></font></a></td> + </tr> + </table> + </div> + + <br/> + <br/> + <div style="width:50%;text-align:center;margin: 0px auto;"> + <?php include("fulldate.php");?> + <!-- Le menu --> + <!-- Le corps --> + <br/> + <?php echo"Bienvenue sur la page des choix !";?> + + <form method="post" action="traitement2.php" > + <h3>Tu veux voir l'autre? Entrer le nom du film!</h3> + <input type="text" name="nom" onblur="verifname(this)" /> <br/> + + <script> + function verif(champ, erreur) + { + + if(erreur) + champ.style.backgroundColor = "#fba"; + else + champ.style.backgroundColor = ""; + } + + function verifname(champ) + { + if(champ.value.length < 2 || champ.value.length > 6) + { + verif(champ,true); + return false; + } + else + { + verif(champ,false); + return true; + } + } + </script> + <input type="submit" value="Submit"> + </form> + <br/> + <br/> + <h3> Sinon,choisis ce que tu veux!</h3> + <br/> + <form method="post" action="traitement.php" > + <p> Tu veux un discount?</p> + <br/> + <input type="radio" name="discount" value=0.5 /> -18<br/> + <input type="radio" name="discount" value=0.6 /> etudiant<br/> + <input type="radio" name="discount" value=0.8 /> promo<br/> + + <p> Tu veux quelle place?</p> + <select name="type"> + + <option value="min">min</option> + + <option value="moyen">moyen</option> + + <option value="vip">vip</option> + + </select> + <?php + $conn_string = "host=127.0.0.1 port=5432 dbname=postgres user=postgres password=19940625" ; + $bd= (pg_connect($conn_string)); + if (!$bd) { + $erreur="problème de connexion au base de données"; + } + else{ + $requete="SELECT n_representation,jour,horaire FROM representation WHERE nom_piece='zombie1'"; + $response=pg_query($bd,$requete); + if ($response){ + $row1 = pg_fetch_assoc($response); + $jour1=$row1['jour']; + $horaire1=$row1['horaire']; + $row2 = pg_fetch_assoc($response); + $jour2=$row2['jour']; + $horaire2=$row2['horaire']; + } + } + ?> + + <p> Tu veux voir quand?</p> + <select name="time"> + + <option value=<?php echo $row1['n_representation']?>><?php echo $jour1.' '.$horaire1 ;?></option> + + <option value=<?php echo $row2['n_representation']?>><?php echo $jour2.' '.$horaire2 ;?></option> + + </select> + <br/> + <input type="submit" value="Submit"> + + </form> +</div> + </body> +</html> diff --git a/create.sql b/create.sql index 0f547565817d14598fe62969db5207592468043d..c6b0d4307280a7f3404de4eb25b3aae1d1d71bfc 100644 --- a/create.sql +++ b/create.sql @@ -20,7 +20,6 @@ CREATE TABLE compte_client( prenom VARCHAR(100) NOT NULL, DoB DATE, MdP VARCHAR(100) NOT NULL, - adm boolean NOT NULL, CONSTRAINT pk_compte PRIMARY KEY (n_compte) ); diff --git a/fill.sql b/fill.sql index cccee785b26a58a8c53d3464287c11ed1a2c0d37..55cc75416347aa3a3af7fab62c6b646db122f7dd 100644 --- a/fill.sql +++ b/fill.sql @@ -6,12 +6,12 @@ -- ################################################################### --# compte_client -INSERT INTO compte_client -VALUES('peng2015','PENG','QIXIANG','1994-06-25','PPP',TRUE); -INSERT INTO compte_client -VALUES('koumaar2015','JAYASHANKAR','KOUMAARASHANKAR','1995-09-04','JJJ',TRUE); -INSERT INTO compte_client -VALUES('souley2015','SOULEY','SALIF','1993-06-20','SSS',TRUE); +INSERT INTO compte_client (login,nom,prenom,dob,mdp) +VALUES('peng2015','PENG','QIXIANG','1994-06-25','PPP'); +INSERT INTO compte_client (login,nom,prenom,dob,mdp) +VALUES('koumaar2015','JAYASHANKAR','KOUMAARASHANKAR','1995-09-04','JJJ'); +INSERT INTO compte_client (login,nom,prenom,dob,mdp) +VALUES('souley2015','SOULEY','SALIF','1993-06-20','SSS'); --# salle INSERT INTO salle @@ -27,13 +27,13 @@ INSERT INTO piece VALUES('zombie2','zombie2','zombie2','zombie2'); --# representation -INSERT INTO representation +INSERT INTO representaion VALUES(1,'zombie1','00:00:00','2016-05-31',1); -INSERT INTO representation +INSERT INTO representaion VALUES(2,'zombie1','02:00:00','2016-05-31',1); -INSERT INTO representation +INSERT INTO representaion VALUES(3,'zombie2','00:00:00','2016-05-31',2); -INSERT INTO representation +INSERT INTO representaion VALUES(4,'zombie2','02:00:00','2016-05-31',2); --# place diff --git a/fulldate.php b/fulldate.php new file mode 100644 index 0000000000000000000000000000000000000000..71f7fcf82030a7484d0dbd4ea26a5dbf70e9d46b --- /dev/null +++ b/fulldate.php @@ -0,0 +1,31 @@ +<?php + +// Enregistrons les informations de date dans des variables + + +$jour = date('d'); + +$mois = date('m'); + +$annee = date('Y'); + + +$heure = date('H'); + +$minute = date('i'); + + +if ($heure <= 12) +{ + echo "Bonjour !"; +} + +elseif ($heure > 12) +{ + echo "Bonsoir !"; +} +echo ' Nous sommes le ' . $jour . '/' . $mois . '/' . $annee . ' et il est ' . $heure. ' h ' . $minute.'.'; +echo "\n"; + +?> + diff --git a/imag/logo-carte-bleue.jpg b/imag/logo-carte-bleue.jpg new file mode 100644 index 0000000000000000000000000000000000000000..44a05709a8f436b35789491352762870b72f74ae Binary files /dev/null and b/imag/logo-carte-bleue.jpg differ diff --git a/traitement.php b/traitement.php new file mode 100644 index 0000000000000000000000000000000000000000..b8d8c0a2b0770b3b47c63822f27c09e123b9ee78 --- /dev/null +++ b/traitement.php @@ -0,0 +1,61 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8" /> + <title>page des choix </title> + <link rel="stylesheet" type="text/css" href="style_home.css" /> + </head> + + <body bgcolor="#808080"> + + <!-- L'en-tête --> + <div class="container"> + <table> + <col width="100"/> + <col width="1000"/> + <tr> + <td><a href="#"><img src="imag/opera_logo.jpg" /></a></td> + <td align="center"><h1><font color="#808080">Hall Welcomes <?php session_start();echo $_SESSION['login'];?></font></h1></td> + <td align="right"><font color="red"><a href="home.html" title ="deconnection">disconnect</a></font></a></td> + </tr> + </table> + </div> + +<?php + $conn_string = "host=127.0.0.1 port=5432 dbname=postgres user=postgres password=19940625" ; + $bd= (pg_connect($conn_string)); + if (!$bd) { + $erreur="problème de connexion au base de données"; + } + else{ + $login=$_SESSION['login']; + $time=$_POST['time']; + $discount=$_POST['discount']; + $type=$_SESSION['type']; + $request1="SELECT n_salle,jour,horaire FROM representation WHERE n_representation='$time'"; + $response=pg_query($bd,$request1); + if ($response){ + $row1 = pg_fetch_assoc($response); + $jour=$row1['jour']; + $horaire=$row1['horaire']; + } + $request2="select n_compte from compte_client where login='$login'"; + $response=pg_query($bd,$request2); + if ($response){ + $row1 = pg_fetch_assoc($response); + $n_compte=$row1['n_compte']; + } + $request3="INSERT INTO billet VALUES ('$time',1,'$n_compte','$discount')'"; + $response=pg_query($bd,$request3); + } + +?> + + + <div style="width:50%;text-align:center;margin: 0px auto;"> +<p>Vous avez choisi un tarif <?php echo $discount ?> , et a <?php echo $jour.' '.$horaire; ?> !</p> +<p> pour changer <a href="choix.php#ancre_formulaire">Ici</a></p> +<a href="Accueil_paiement.php">Payer!SVP!</a> +</div> +</body> +</html> diff --git a/traitement2.php b/traitement2.php new file mode 100644 index 0000000000000000000000000000000000000000..ba2850cfecf1b99497e3ba96cbb3815c20d72a82 --- /dev/null +++ b/traitement2.php @@ -0,0 +1,10 @@ +<?php +include("Miseenpage_login.php"); +entete("SORRY"); +?> +<div style="width:30%;text-align:center; border: 5px solid black;margin: 0px auto;"> +<h2> Sorry,we do not have it!<br/><a href="choix.php"> please go back!</a></h2s> +</div> +<?php +pied(); +?>