diff --git a/AccountConnection.php b/AccountConnection.php index 050f7513cda35a08aa62351378576ed6309917a1..6cf1280cc426bf4c0e499944e0fb51866010305b 100644 --- a/AccountConnection.php +++ b/AccountConnection.php @@ -3,22 +3,25 @@ <head> <title>Drinkpedia</title> <meta charset="UTF-8"> - <link rel="stylesheet" type="text/css" href="css/MyAccount.css"> + <link rel="stylesheet" type="text/css" href="css/Account.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> + <script src="scripts/DataQuery.js"></script> </head> <body> - <h1>Connexion</h1> + <div class="content"> + <h1>Connexion</h1> + <label>Email</label> + <input id="emailInput" type="email"> + <label>Mot de passe</label> + <input id="pwdInput" type="password"> + <button onclick="tryConnect();">Se connecter</button> - <label>Email</label> - <input id="emailInput" type="email"> - <label>Mot de passe</label> - <input id="pwdInput" type="password"> - <button onclick="tryConnect();">Se connecter</button> - <label>Pas de compte ?</label> - <a onclick="goToCreate();">Créer</a> + <div class="alt"> + <a onclick="goToCreate();">Pas de compte ? Créer</a> + </div> + </div> - <script src="scripts/DataQuery.js"></script> <script> function goToCreate() { @@ -26,7 +29,7 @@ event: 'usercreate', value: '' }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } function tryConnect() @@ -42,7 +45,7 @@ event: 'useraccount', value: e }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } else { diff --git a/AccountCreation.php b/AccountCreation.php index cbbfd0564f608c0a6ace2c05f43bbf023b0ccf83..f4219a3a86235ca681ead1d437f80c4cbd45c2b2 100644 --- a/AccountCreation.php +++ b/AccountCreation.php @@ -3,22 +3,25 @@ <head> <title>Drinkpedia</title> <meta charset="UTF-8"> - <link rel="stylesheet" type="text/css" href="css/MyAccount.css"> + <link rel="stylesheet" type="text/css" href="css/Account.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> + <script src="scripts/DataQuery.js"></script> </head> <body> - <h1>Création d'un compte</h1> + <div class="content"> + <h1>Création d'un compte</h1> + <label>Email</label> + <input id="emailInput" type="email"> + <label>Mot de passe</label> + <input id="pwdInput" type="password"> + <button onclick="createAccount();">Créer mon compte</button> - <label>Email</label> - <input id="emailInput" type="email"> - <label>Mot de passe</label> - <input id="pwdInput" type="password"> - <button onclick="createAccount();">Créer mon compte</button> - <label>Déjà un compte ?</label> - <a onclick="goToConnect();">Se connecter</a> + <div class="alt"> + <a onclick="goToConnect();">Déjà un compte ? Se connecter</a> + </div> + </div> - <script src="scripts/DataQuery.js"></script> <script> function goToConnect() { @@ -26,7 +29,7 @@ event: 'userconnect', value: '' }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } function createAccount() @@ -50,7 +53,7 @@ event: 'useraccount', value: e }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } }) } diff --git a/AdvancedSearch.php b/AdvancedSearch.php index 0da62a5c3268b11c24fed53d20115dfa8205982f..3701f6913c671728c412ff30f36fa2f17f9fb457 100644 --- a/AdvancedSearch.php +++ b/AdvancedSearch.php @@ -185,7 +185,7 @@ showScore: 'false', title: 'Résultats de la recherche :' }; - window.top.postMessage(data, [data.event, data.value, data.showScore, data.title]); + window.parent.postMessage(data, [data.event, data.value, data.showScore, data.title]); } function notifyParentScore(e) // Send a message to the parent window, asking to display the recipe #e @@ -196,7 +196,7 @@ showScore: 'false', title: 'Résultats de la recherche :' }; - window.top.postMessage(data, [data.event, data.value, data.showScore, data.title]); + window.parent.postMessage(data, [data.event, data.value, data.showScore, data.title]); } function appendIngredient(ing, status) diff --git a/Hierarchy.php b/Hierarchy.php index b664e0e52cb06dad84004ef74e2449e6447d662d..57c4b254912ac13f139223fe54267d16c1ee58ae 100644 --- a/Hierarchy.php +++ b/Hierarchy.php @@ -70,7 +70,7 @@ event: 'hierarchyDisplay', value: $aliment }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } </script> diff --git a/Home.php b/Home.php index 275d836cb28a15a8acb3f99124b9e9d8873d2c2d..c5abbe5237b86b06bbf5638c151f8c5c5910ebac 100644 --- a/Home.php +++ b/Home.php @@ -6,14 +6,14 @@ <link rel="stylesheet" type="text/css" href="css/Home.css"> </head> -<body id="body"> - - <?php +<?php include 'scripts/SQL.php'; //connect_db(); - ?> +<body id="body"> + + <div class="background"></div> <div id="content"> diff --git a/MyAccount.php b/MyAccount.php index 442707276673045c7797c31eb6b1170956418098..5139b19c3aad900dae87ef9370c5d88dac7cf4d5 100644 --- a/MyAccount.php +++ b/MyAccount.php @@ -3,7 +3,7 @@ <head> <title>Drinkpedia</title> <meta charset="UTF-8"> - <link rel="stylesheet" type="text/css" href="css/MyAccount.css"> + <link rel="stylesheet" type="text/css" href="css/Account.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="scripts/DataQuery.js"></script> </head> @@ -18,16 +18,20 @@ event: 'userconnect', value: e }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } }); </script> - <h1>My Account</h1> + <div class="content"> + <h1>Mon compte</h1> - <label id="email"></label> - - <button onclick="disconnect();">Se déconnecter</button> + <label id="email"></label> + <div class="alt"> + <a onclick="alert('To be implemented');">Changer mon mot de passe</a> + </div> + <button onclick="disconnect();">Se déconnecter</button> + </div> <script> @@ -44,7 +48,7 @@ event: 'userconnect', value: '' }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); }); } </script> diff --git a/MyFavouriteRecipes.php b/MyFavouriteRecipes.php index e5a007d78b4f351b51aa140b0417e358e7fa63f4..6dfffc582f9459ed22cbe7b46a7c533d099a815d 100644 --- a/MyFavouriteRecipes.php +++ b/MyFavouriteRecipes.php @@ -4,10 +4,10 @@ <title>Drinkpedia</title> <meta charset="UTF-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> + <script src="scripts/DataQuery.js"></script> </head> <body> - <script src="scripts/DataQuery.js"></script> <script> getFavourites(function(e) @@ -18,7 +18,7 @@ showScore: 'false', title: 'Favoris :' }; - window.top.postMessage(data, [data.event, data.value, data.showScore, data.title]); + window.parent.postMessage(data, [data.event, data.value, data.showScore, data.title]); }) </script> </body> diff --git a/RecipeList.php b/RecipeList.php index 8a145305e2b4cc66497ac056013c3cfe2cc992b0..ea01bf6813d6fa73bbd962163b4e71f6c67ad28c 100644 --- a/RecipeList.php +++ b/RecipeList.php @@ -5,6 +5,7 @@ <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="css/RecipeList.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> + <script src="scripts/DataQuery.js"></script> </head> <body> @@ -58,7 +59,6 @@ </ul> - <script src="scripts/DataQuery.js"></script> <script> document.addEventListener('keyup', function (e) { @@ -68,7 +68,7 @@ event: 'keyup', value: e.keyCode }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } }); @@ -78,7 +78,7 @@ event: 'recipeselect', value: id }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } function switchFavourite(img) diff --git a/RecipeView.php b/RecipeView.php index 517e7ec80b5dee8fd49958272c1c4c6121cab54b..5c07d1ff831c74ebf4468fa562af9ea3866795a6 100644 --- a/RecipeView.php +++ b/RecipeView.php @@ -2,6 +2,7 @@ <head> <link rel="stylesheet" type="text/css" href="css/RecipeView.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> + <script src="scripts/DataQuery.js"></script> </head> <body> @@ -47,7 +48,6 @@ </div> - <script src="scripts/DataQuery.js"></script> <script> document.addEventListener('keyup', function (e) @@ -58,7 +58,7 @@ event: 'keyup', value: e.keyCode }; - window.top.postMessage(data, [data.event, data.value]); + window.parent.postMessage(data, [data.event, data.value]); } }); diff --git a/Recipes.php b/Recipes.php index 48c726f71d29e19347e311e3c19305d4f123ed46..41183a0d690d44fcd4935a1b41513658c9e8547c 100644 --- a/Recipes.php +++ b/Recipes.php @@ -3,12 +3,11 @@ <head> <title>Drinkpedia</title> <meta charset="UTF-8"> - <link rel="stylesheet" type="text/css" href="css/Recipes.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> + <script src="scripts/DataQuery.js"></script> </head> <body> - <script src="scripts/DataQuery.js"></script> <script> getRecipes([], [], 0, true, true, function(e) { var data = { @@ -17,7 +16,7 @@ showScore: 'false', title: 'Tous les cocktails :' }; - window.top.postMessage(data, [data.event, data.value, data.showScore, data.title]); + window.parent.postMessage(data, [data.event, data.value, data.showScore, data.title]); }); </script> diff --git a/css/Account.css b/css/Account.css new file mode 100644 index 0000000000000000000000000000000000000000..42443985f359af6e331280f722b01fc6bcbc2b96 --- /dev/null +++ b/css/Account.css @@ -0,0 +1,54 @@ +body { + display: flex; + justify-content: center; +} + +.content { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin: 25px; + background-color: rgba(255, 255, 255, 0.75); + padding: 25px; + width: 50vw; + border-radius: 25px; +} + +input { + margin-top: 5px; + width: 30%; + font-size: 20px; + font-weight: bold; + padding: 2px; +} + +label { + margin-top: 10px; + font-size: 24px; +} + +button { + font-size: x-large; + font-weight: bold; + border-radius: 10px; + background-color: darkgray; + margin: 10px; + cursor: pointer; +} + +button:hover { + background-color: grey; +} + +.alt { + margin: 25px; + display: inline; +} + +a { + color: blue; + font-weight: bold; + text-decoration: underline; + cursor: pointer; +} \ No newline at end of file diff --git a/css/AdvancedSearch.css b/css/AdvancedSearch.css index 8fcb98ffdba002ead1aeeb41475f48d70a53a093..fd83ef5c76ecccde0d2e25989c4772b03d7a53f5 100644 --- a/css/AdvancedSearch.css +++ b/css/AdvancedSearch.css @@ -50,6 +50,7 @@ body { background-color: darkgray; margin: 25px; padding: 15px; + cursor: pointer; } #searchDiv button:hover { diff --git a/css/MyAccount.css b/css/MyAccount.css deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/css/RecipeList.css b/css/RecipeList.css index ae39ceff00e0efc2924d13efa6de05f96073d1ef..126c1840a0ea8bb860ea1d9a3a91899c269aa67f 100644 --- a/css/RecipeList.css +++ b/css/RecipeList.css @@ -11,7 +11,7 @@ ul { ul li { padding: 8px 16px; - height: 75px; + height: min-content; border-bottom: 1px solid black; background-color: rgba(88, 88, 88, 0.5); display: block; diff --git a/css/RecipeView.css b/css/RecipeView.css index 1779cf4936f11d20407f68f1191e7975c9c1655d..0d22b7323bd675620651523eac41c9b15fb1e54b 100644 --- a/css/RecipeView.css +++ b/css/RecipeView.css @@ -15,4 +15,5 @@ img { right: 0px; width: 32px; height: 32px; + cursor: pointer; } \ No newline at end of file diff --git a/css/Recipes.css b/css/Recipes.css deleted file mode 100644 index 43e70078684840c30672dc7608e8eee5af700f9c..0000000000000000000000000000000000000000 --- a/css/Recipes.css +++ /dev/null @@ -1,5 +0,0 @@ -li:hover { - cursor: pointer; - color: blue; - font-size: x-large; -} \ No newline at end of file diff --git a/scripts/SQL.php b/scripts/SQL.php index 4b5453b2f6eeabefc88976b5a6a7e09d1b4691eb..010c2b5f7767df584689674591db3f03a678dfef 100644 --- a/scripts/SQL.php +++ b/scripts/SQL.php @@ -1,9 +1,13 @@ <?php - -session_start(); -$bdd = new PDO('mysql:host=localhost;dbname=drinkpedia;charset=utf8', 'root', '', array( +error_reporting(E_ERROR | E_PARSE); +if(session_status() == PHP_SESSION_NONE) session_start(); +/*$bdd = new PDO('mysql:host=localhost;dbname=drinkpedia;charset=utf8', 'root', '', array( + PDO::ATTR_PERSISTENT => true +));*/ +$bdd = new PDO('mysql:host=localhost;dbname=id15804762_drinkpedia;charset=utf8', 'id15804762_access', 'DAccessPwd!1', array( PDO::ATTR_PERSISTENT => true )); + $bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); function connect_db() @@ -16,7 +20,7 @@ function create_user($u_email, $u_pwd) global $bdd; $res = $bdd->query('SELECT email FROM user WHERE email LIKE \'' . $u_email . '\''); if($res->fetch()) return '0'; - $bdd->query('INSERT INTO user (email, pwdhash, favourites) VALUES (\'' . $u_email . '\', \'' . $u_pwd . '\', \'1|2|4\')'); + $bdd->query('INSERT INTO user (email, pwdhash, favourites) VALUES (\'' . $u_email . '\', \'' . $u_pwd . '\', \'\')'); return '1'; }