diff --git a/WEB/connectionBD.php b/WEB/connexionBD.php
similarity index 60%
rename from WEB/connectionBD.php
rename to WEB/connexionBD.php
index 8ee39c4..4541648 100644
--- a/WEB/connectionBD.php
+++ b/WEB/connexionBD.php
@@ -1,19 +1,7 @@
-
+ $db = pg_connect("host=$host port=5432 dbname=$dbname user=$user password=$pass") or die("Erreur lors de la connexion à la base de données.");
\ No newline at end of file
diff --git a/WEB/deconnexion.php b/WEB/deconnexion.php
index c4dfb65..3941d16 100644
--- a/WEB/deconnexion.php
+++ b/WEB/deconnexion.php
@@ -1,21 +1,11 @@
diff --git a/WEB/inscription.php b/WEB/inscription.php
index 8c5a3a7..2bdf50f 100644
--- a/WEB/inscription.php
+++ b/WEB/inscription.php
@@ -1,18 +1,58 @@
0) {
+ echo "
PHP a ignoré les données POST à cause d'une requête dépassant post_max_size (" . ini_get('post_max_size') . ").
";
+ exit();
+ }
+ 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 = strtolower(htmlentities(pg_escape_string($_POST['mail_field'])));
+ $phone = htmlentities(pg_escape_string($_POST['phone']));
+
+ if (!filter_var($mail, FILTER_VALIDATE_EMAIL)) {
+ header('Location: inscription.php?error=1');
+ exit();
+ } elseif (!isMailUnique($db, $mail)) {
+ header('Location: inscription.php?error=2');
+ exit();
+ } elseif (!isLoginUnique($db, $login)) {
+ header('Location: inscription.php?error=3');
+ exit();
+ } else {
+ uploadAvatar($mail);
+ $result = creerUtilisateur($db, $mail, $password, $prenom, $nom, $login, $phone, $dateN);
+ if ($result) {
+ header('Location: index.php');
+ } else {
+ header('Location: inscription.php?error=6');
+ }
+ }
+
+ }
+} else {
+ header('Location: tableauBord/tableauBord.php');
+}
+
+function printError()
+{
+ if (isset($_GET['error'])) {
$erreur = getError($_GET['error']);
echo "PHP a ignoré les données POST à cause d'une requête dépassant post_max_size (".ini_get('post_max_size').").
";
- exit();
- }
- 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 = strtolower(htmlentities(pg_escape_string ($_POST['mail_field'])));
- $phone = htmlentities(pg_escape_string ($_POST['phone']));
-
- if(!filter_var($mail, FILTER_VALIDATE_EMAIL)){
- header('Location: inscription.php?error=1');
- exit();
- }
- elseif(!isMailUnique($mail)){
- header('Location: inscription.php?error=2');
- exit();
- }
- elseif(!isLoginUnique($login)){
- header('Location: inscription.php?error=3');
- exit();
- }
- else{
- uploadAvatar($mail);
- $result = creerUtilisateur($mail, $password, $prenom, $nom, $login, $phone, $dateN);
- if($result){
- header('Location: index.php');
- }
- else{
- header('Location: inscription.php?error=6');
- }
- }
-
- }
- }
- else{
- header('Location: tableauBord/tableauBord.php');
- }
-}
-
?>
@@ -172,7 +164,7 @@ function init(){
-
Bienvenue
+
Bienvenue
@@ -158,19 +142,19 @@ function showVoiture(){
-
Vous avez trajets proposés à effectuer.
+
Vous avez trajets proposés à effectuer.
-
Vous avez trajets réservés à effectuer.
+
Vous avez trajets réservés à effectuer.
-
Vous avez messages non lus.
+
Vous avez messages non lus.
-
Vous avez avis non lus.
+
Vous avez avis non lus.