diff --git a/WEB/connectionBD.php b/WEB/connectionBD.php new file mode 100644 index 0000000..4a94735 --- /dev/null +++ b/WEB/connectionBD.php @@ -0,0 +1,23 @@ + + + + + + + Bienvenue sur Upssi'Covoit + + +
+

Bienvenue sur Upssi'Covoit

+
+
+ + +
+
+ + +
+ $erreur

"; + } + ?> + +
+

Si vous n'avez pas de compte cliquez ici.

+
+ + \ No newline at end of file diff --git a/WEB/index_inscription.css b/WEB/index_inscription.css new file mode 100644 index 0000000..b4720b5 --- /dev/null +++ b/WEB/index_inscription.css @@ -0,0 +1,115 @@ +*{ + margin: 0; + padding: 0; + font-family: "Arial"; + font-size: 1em; +} + +body{ + background-image: url("wallpaper.jpg"); + background-attachment: fixed; + padding-top: 5%; + padding-bottom: 5%; +} + +#formulaireMail{ + margin-top: 50vh; + transform: translate(-50%, -50%); +} + +#formulaire{ + transform: translate(-50%); +} + +#formulaire, #formulaireMail{ + background-color: white; + margin-left: 50vw; + border-radius: 10px; + padding: 4em; + width: 40%; +} + +#enregistrer{ + margin-top: 1em; + text-align: center; +} + +h1{ + text-align: center; +} + +form{ + margin-top: 3em; +} + +.form{ + width: 55%; + box-sizing: border-box; + border: 1px solid grey; + margin-bottom: 0.7em; +} + +.button{ + cursor: pointer; + font-weight: bold; + padding: 8px; + color: white; + background-color: rgb(65, 154, 28); + border-radius: 5em; + border: none; +} + +.button:hover{ + background-color: rgb(48, 112, 20); + border-color: rgb(48, 112, 20); +} + +.button:disabled{ + cursor: not-allowed; + background-color: grey; +} + +#submit{ + margin-top: 1em; + margin-left: 50%; + transform: translate(-50%); +} + +.line{ + display: flex; + flex-wrap: wrap; + flex-direction: row; + width: 100%; +} + +#error{ + margin-bottom: 1em; +} + +.error{ + color: red; + text-align: center; +} + +label{ + font-size: 1.1em; + word-break: break-all; + box-sizing: border-box; + display: block; + width: 43%; +} + +input{ + margin-left: 2%; + font-size: 1em; +} + +h1{ + font-size: 2em; +} + +button{ + color: forestgreen; + border-color: forestgreen; + border-radius: 5em; +} diff --git a/WEB/inscription.js b/WEB/inscription.js new file mode 100644 index 0000000..e9e9675 --- /dev/null +++ b/WEB/inscription.js @@ -0,0 +1,25 @@ +let messageAffiche = false; +window.onload = init; + +function init(){ + let password = document.getElementById("password"); + let confirmation = document.getElementById("confirmation"); + + password.oninput = verifPassword; + confirmation.oninput = verifPassword; +} + +function verifPassword() { + let message = "Les mots de passe ne correspondent pas."; + if( !messageAffiche && password.value != "" && confirmation.value!="" && password.value != confirmation.value ){ + confirmation.insertAdjacentHTML("afterend", "

" + message + "

"); + document.getElementById("submit").disabled = true; + messageAffiche = true; + } + else if ( messageAffiche && password.value == confirmation.value ) { + let child = document.getElementById("error"); + child.parentNode.removeChild(child); + document.getElementById("submit").disabled = false; + messageAffiche = false; + } +} \ No newline at end of file diff --git a/WEB/inscription.php b/WEB/inscription.php new file mode 100644 index 0000000..ec54328 --- /dev/null +++ b/WEB/inscription.php @@ -0,0 +1,144 @@ +$erreur

"; + } +} + +function getError($code){ + switch ($code){ + case 1: + return "Cette adresse est déjà associée à un compte."; + case 2: + return "Ce login est déjà associé à un compte."; + case 3: + return "Erreur lors de la création du compte."; + case 4: + return "Erreur lors de la vérification de l'unicité de l'adresse mail."; + } +} + +function isMailUnique($db, $mail){ + $result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE mail = $1;", array($mail)); + if($result){ + $row = pg_fetch_array($result); + return strcmp($row['mail'], $mail); + } + return false; +} + +function isLoginUnique($db, $login){ + $result = pg_query_params($db, "SELECT * FROM Utilisateur WHERE login = $1;", array($login)); + if($result){ + $row = pg_fetch_array($result); + return strcmp($row['login'], $login); + } + return false; +} + +function creerUtilisateur($db, $mail, $password, $prenom, $nom, $login, $phone, $dateN){ + $result = pg_query_params($db, "INSERT INTO Utilisateur VALUES ($1, $2, $3, $4, $5, $6, to_date($7, 'YYYY/MM/DD'), false);", array($mail, $password, $prenom, $nom, $login, $phone, $dateN)); + return $result; +} + + +function init(){ + session_start(); + + if(!isset($_SESSION['mail'])){ + if(isset($_POST['mail_field'])){ + + $login = htmlentities(pg_escape_string ($_POST['login_field'])); + $password = htmlentities(pg_escape_string ($_POST['password'])); + $prenom = htmlentities(pg_escape_string ($_POST['prenom'])); + $nom = htmlentities(pg_escape_string ($_POST['nom'])); + $dateN = htmlentities(pg_escape_string ($_POST['dateN'])); + $mail = htmlentities(pg_escape_string ($_POST['mail_field'])); + $phone = htmlentities(pg_escape_string ($_POST['phone'])); + + if(!isMailUnique($db, $mail)){ + header('Location: inscription.php?error=1'); + } + elseif(!isLoginUnique($db, $mail)){ + header('Location: inscription.php?error=2'); + } + else{ + $result = creerUtilisateur($db, $mail, $password, $prenom, $nom, $login, $phone, $dateN); + if($result){ + header('Location: index.php'); + } + else{ + header('Location: inscription.php?error=3'); + } + } + + } + } + else{ + header('Location: tableauBord/tableauBord.php'); + } +} + +?> + + + + + + + + + Inscription + + + +
+

Inscription

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+

Si vous avez déjà un compte cliquez ici.

+
+ + \ No newline at end of file diff --git a/WEB/tableauBord/tableauBord.css b/WEB/tableauBord/tableauBord.css new file mode 100644 index 0000000..e80738b --- /dev/null +++ b/WEB/tableauBord/tableauBord.css @@ -0,0 +1,49 @@ +*{ + margin: 0; + padding: 0; + font-family: "Calibri Light"; +} + +#content{ + margin-top: 8vh; + background-color: aqua; + margin-left: 50vw; + border-radius: 10px; + padding: 4em; + width: 84%; + transform: translate(-50%); +} + +.menu { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: center; + background-color: rgb(65, 154, 28); +} + +.menuItem { + 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; +} + +#imgProfil{ + margin-top: 30px; + margin-left: 50%; + transform: translate(-50%); + max-width: 300px; + max-height: 300px; + border-radius: 10px; +} \ No newline at end of file diff --git a/WEB/tableauBord/tableauBord.js b/WEB/tableauBord/tableauBord.js new file mode 100644 index 0000000..75c631a --- /dev/null +++ b/WEB/tableauBord/tableauBord.js @@ -0,0 +1,10 @@ +window.onload = init; + +function init(){ + let button = document.getElementById('btnDeco'); + button.onclick = deconnexion; +} + +function deconnexion() { + document.getElementById('formDeco').submit(); +} \ No newline at end of file diff --git a/WEB/tableauBord/tableauBord.php b/WEB/tableauBord/tableauBord.php new file mode 100644 index 0000000..d8c523d --- /dev/null +++ b/WEB/tableauBord/tableauBord.php @@ -0,0 +1,70 @@ + + + + + + + + Tableau de bord + + + + +
+

Bonjour +

+
+ +
+
+ + \ No newline at end of file diff --git a/WEB/wallpaper.jpg b/WEB/wallpaper.jpg new file mode 100644 index 0000000..4ef0920 Binary files /dev/null and b/WEB/wallpaper.jpg differ