Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 1 | Question 1 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- CREATE TABLE utilisateur (
- idutilisateur int PRIMARY KEY AUTO_INCREMENT,
- nom varchar(255),
- prenom varchar(255),
- email varchar(255),
- pass varchar(255),
- tel varchar(255)
- );
- CREATE TABLE vehicule (
- matricule int PRIMARY KEY,
- idutilisateur int,
- type varchar(255),
- marque varchar(255)
- );
- CREATE TABLE placestationnement (
- idplace int PRIMARY KEY AUTO_INCREMENT,
- type varchar(255),
- etat varchar(255),
- prix varchar(255)
- );
- CREATE TABLE stationner (
- matricule int PRIMARY KEY,
- idplace int,
- datestationnement date
- );
- ALTER TABLE utilisateur ADD FOREIGN KEY (idutilisateur) REFERENCES vehicule(idutilisateur);
- ALTER TABLE placestationnement ADD FOREIGN KEY (idplace) REFERENCES stationner(idplace);
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 1 | Question 2 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- INSERT INTO utilisateur (idutilisateur, nom, prenom, email, pass, tel) VALUES ('1', 'Saidi', 'Ahmed', 'user@hotmail.com', '123456', '0652410021'),('2', 'Ghanam', 'Karim', 'user2@gmail.com', '123456789', '0662718022');
- INSERT INTO vehicule (matricule, idutilisateur, type, marque) VALUES ('40', '1', 'Voiture', 'Mercedes'),('41', '2', 'Voiture', 'BMW');
- INSERT INTO placestationnement (idplace, type, etat, prix) VALUES ('12', 'Place A', 'occupe', '100 Dh'),('15', 'Place B', 'Libre', '100 Dh');
- INSERT INTO stationner (matricule, idplace, datestationnement) VALUES ('40', '12', '2016-06-24'),('41', '15', '2016-06-25');
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 1 | Question 3 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- A - ALTER TABLE placestationnement ADD CHECK (etat = "occupe" OR etat = "libre");
- B - ALTER TABLE vehicule ADD CHECK (type = "voiture" OR type = "camion" OR type = "motos");
- ALTER TABLE placestationnement ADD CHECK (type = "voiture" OR type = "camion" OR type = "motos");
- C - ALTER TABLE stationner ADD CHECK (datestationnement = CURDATE());
- D - ALTER TABLE placestationnement ADD CHECK (etat = "" OR etat = NULL);
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 1 | Question 4 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- A - SELECT * FROM placestationnement WHERE etat = "Libre";
- B - SELECT count(idplace) FROM stationner WHERE matricule IN (SELECT matricule FROM vehicule);
- C - SELECT idplace AS Place_non_Occupees FROM placestationnement WHERE etat != "ocuppe";
- D - ?
- 5 - ?
- 6 - ?
- 7 - ?
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 2 | Question 1 - 2 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- <?php
- session_start();
- $connect = mysqli_connect("localhost", "root", "", "EFF_1");
- if (isset($_POST['submit'])) {
- $email = $_POST['email'];
- $password = $_POST['password'];
- $query = mysqli_query($connect, "SELECT * FROM utilisateur WHERE email = '$email' AND pass = '$password'");
- $rows = mysqli_num_rows($query);
- if ($rows > 0) {
- if (isset($_POST['cookie']) && $_POST['cookie'] == 'on') {
- setcookie("email", "$email", time() + 60 * 60 * 24);
- setcookie("password", "$password", time() + 60 * 60 * 24);
- }
- $_SESSION['email'] = $email;
- header('Location: ajouter.php');
- }
- }
- ?>
- <form method="POST" action="">
- <h1>Connexion</h1>
- <input type="email" name="email" placeholder="Email@exemple.com" />
- <input type="password" name="password" placeholder="Password" />
- <input type="checkbox" name="cookie" /> Se Souvenir de Moi
- <input type="submit" value="Se Connecter" name="submit" />
- </form>
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 2 | Question 3 - a - c =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- <?php
- $connect = mysqli_connect("localhost", "root", "", "EFF_1");
- if (isset($_POST['valider'])) {
- $nom = $_POST['nom'];
- $prenom = $_POST['prenom'];
- $email = $_POST['email'];
- $telephone = $_POST['telephone'];
- $password = $_POST['password'];
- $confirm = $_POST['confirm'];
- $insert = mysqli_query($connect, "INSERT INTO utilisateur (nom, prenom, email, pass, tel) VALUES ('$nom','$prenom','$email','$password','$telephone')");
- }
- ?>
- <script>
- function valideform() {
- var nom = document.GetElementById("nom").value;
- var prenom = document.GetElementById("prenom").value;
- var email = document.GetElementById("email").value;
- var password = document.GetElementById("password").value;
- if (nom == "" || prenom == "" || email == "" || password == "") {
- alert("Tous Les Champs Sont Obligatoire");
- }
- }
- function checkpassword() {
- var password = document.GetElementById('password').value;
- var confirmpassword = document.GetElementById('$confirmpassword').value;
- if (password != confirmpassword) {
- alert('Les Deux Mot de passe Son Diff');
- }
- }
- </script>
- <form method="POST" action="" onsubmit="return valideform()">
- <h1>Créer un Compte utilisateur</h1>
- <input type="text" id="nom" name="nom" placeholder="votre nom" />
- <input type="text" id="prenom" name="prenom" placeholder="votre prenom" />
- <input type="email" id="email" name="email" placeholder="votre email" />
- <input type="text" name="telephone" placeholder="votre téléphone" />
- <input type="password" id="password" name="password" placeholder="votre password" />
- <input type="password" id="confirm" name="confirm" placeholder="confirm password" />
- <input type="submit" value="Valider" name="valider" />
- </form>
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 2 | Question 4 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- <?php
- $connect = mysqli_connect("localhost", "root", "", "EFF_1");
- if (isset($_POST['valider'])) {
- $matricule = $_POST['matricule'];
- $type = $_POST['type'];
- $utilisateur = $_POST['utilisateur'];
- mysqli_query($connect, "INSERT INTO vehicule ('matricule', 'type', 'idutilisateur') VALUES ('$matricule', '$type', '$utilisateur')");
- }
- ?>
- <form method="POST" action="">
- <h1>Ajouter un Véhicule</h1>
- <input type="text" name="matricule" placeholder="Matricule" />
- <select name="type">
- <option disabled>Selectioner le type</option>
- <option value="voiture">Voiture</option>
- <option value="camion">Camion</option>
- <option value="moto">Moto</option>
- </select>
- <select name="utilisateur">
- <option disabled>Selectioner l'utilisateur</option>
- <option value="<?php echo $_COOKIE['email']; ?>"><?php echo $_COOKIE['email']; ?></option>
- </select>
- <input type="submit" value="Valider" name="valider" />
- </form>
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 2 | Question 5 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- <?php
- $connect = mysqli_connect("localhost", "root", "", "EFF_1");
- $find = mysqli_query($connect, "SELECT DISTINCT idplace FROM placestationnement");
- if (isset($_POST['search'])) {
- echo '<style type="text/css">
- #hide {
- display: none;
- }
- </style>';
- $place = $_POST['place'];
- $found = mysqli_query($connect, "SELECT matricule FROM stationner WHERE idplace = '$place'");
- $fl = mysqli_fetch_assoc($found);
- $trouver = mysqli_query($connect, "SELECT marque FROM vehicule WHERE matricule = '$fl['matricule']'");
- $fetch = mysqli_fetch_assoc($trouver);
- }
- ?>
- <form method="POST" action="">
- <h1>Afficher la Véhicule</h1>
- <select name="place">
- <option disabled>Selectioner une place</option>
- <?php
- while ($rows = mysqli_fetch_assoc($find)) {
- echo '<option value="'.$rows['idplace'].'">'.$rows['idplace'].'</option>';
- }
- ?>
- </select>
- <input type="text" value="<?php echo $fetch['marque']; ?>" name="voiture" />
- <input type="submit" id="hide" value="Chercher" name="search" />
- </form>
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 2 | Question 6 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- <?php
- $connect = mysqli_connect("localhost", "root", "", "EFF_1");
- if (isset($_POST['modifier'])) {
- $nom = $_POST['nom'];
- $prenom = $_POST['prenom'];
- $email = $_POST['email'];
- $password = $_POST['password'];
- $tel = $_POST['tel'];
- mysqli_query($connect, "UPDATE utilisateur SET nom = '$nom', prenom = '$prenom', email = '$email', password = '$password', tel = '$tel'
- WHERE email = '$_COOKIE['email']'");
- }
- ?>
- <form method="POST" action="">
- <h1>Modifier votre Information</h1>
- <input type="text" value="" name="nom" />
- <input type="text" value="" name="prenom" />
- <input type="email" value="" name="email" />
- <input type="password" value="" name="password" />
- <input type="text" value="" name="tel" />
- <input type="submit" value="modifier" name="modifier" />
- </form>
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 2 | Question 7 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- <?php
- $connect = mysqli_connect("localhost", "root", "", "EFF_1");
- $montant = mysqli_query($connect, "SELECT SUM(prix) AS total FROM placestationnement
- WHERE idplace IN (SELECT idplace FROM stationner WHERE matricule IN
- (SELECT matricule FROM vehicule WHERE idutilisateur IN
- (SELECT idutilisateur FROM utilisateur WHERE email = '$_COOKIE['email']')))");
- $apayer = mysqli_fetch_assoc($montant);
- ?>
- Montant a Payer : <?php echo $apayer['total']; ?>
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 2 | Question 8 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- <?php
- $connect = mysqli_connect("localhost", "root", "", "EFF_1");
- $placestationnement = mysqli_query($connect, "SELECT * FROM placestationnement");
- if (isset($_GET['supprimer'])) {
- $supprimer = $_GET['supprimer'];
- $delete = mysqli_query($connect, 'DELETE FROM placestationnement WHERE idplace = "$supprimer"');
- }
- ?>
- <form method="POST" action="">
- <h1>Supprimer une place de Stationnement</h1>
- <table>
- <tr>
- <th>idPlace</th>
- <th>Le Type</th>
- <th>Etat</th>
- <th>Prix</th>
- <th>Action</th>
- </tr>
- <?php
- while ($rows = mysqli_fetch_assoc($placestationnement)) {
- echo '
- <td>'.$rows['idplace'].'</td>
- <td>'.$rows['type'].'</td>
- <td>'.$rows['etat'].'</td>
- <td>'.$rows['prix'].'</td>
- <td><a href="profile.php?supprimer='.$rows['idplace'].'"><input type="button" value="Supprimer"></a></td>
- ';
- }
- ?>
- </table>
- </form>
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- /* Dossier 2 | Question 9 =/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=/
- <?php
- /* haDi wa9ela Ma9renahaChi BelHa9 Hayeya Li bgha Yfehma */
- if (isset($_POST['envoyer'])) {
- $user = $_POST['utilisateur'];
- $date = $_POST['date'];
- $numero = $_POST['numero'];
- $message = "Numéro de la Place de Stationnement est : ".$numero." & Date : ".$date;
- mail("$user", 'Numéro de la Place de Stationnement', $message);
- }
- ?>
- <form method="POST" action="">
- <h1>Envoyer un Email</h1>
- <select name="utilisateur">
- <option disabled>Selectioner un utilisateur</option>
- <option value="<?php echo $_COOKIE['email']; ?>"><?php echo $_COOKIE['email']; ?></option>
- </select>
- <input type="date" name="date" />
- <input type="text" value="Numéro de Place" name="place" />
- <input type="submit" value="Envoyer" name="envoyer" />
- </form>
- /* Li maFhamChi ChiHaja --> Facebook ^_^ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement