Commit 4e7b7851 authored by ALGLAVE Ivan's avatar ALGLAVE Ivan
Browse files

Message posting event sent to parent window instead of top window, various fixes

parent 549353ee
......@@ -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>
<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>Pas de compte ?</label>
<a onclick="goToCreate();">Créer</a>
<script src="scripts/DataQuery.js"></script>
<div class="alt">
<a onclick="goToCreate();">Pas de compte ? Créer</a>
</div>
</div>
<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
{
......
......@@ -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>
<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>Déjà un compte ?</label>
<a onclick="goToConnect();">Se connecter</a>
<script src="scripts/DataQuery.js"></script>
<div class="alt">
<a onclick="goToConnect();">Déjà un compte ? Se connecter</a>
</div>
</div>
<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]);
}
})
}
......
......@@ -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)
......
......@@ -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>
......
......@@ -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">
......
......@@ -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>
<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>
......
......@@ -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>
......
......@@ -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)
......
......@@ -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]);
}
});
......
......@@ -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>
......
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
......@@ -50,6 +50,7 @@ body {
background-color: darkgray;
margin: 25px;
padding: 15px;
cursor: pointer;
}
#searchDiv button:hover {
......
......@@ -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;
......
......@@ -15,4 +15,5 @@ img {
right: 0px;
width: 32px;
height: 32px;
cursor: pointer;
}
\ No newline at end of file
li:hover {
cursor: pointer;
color: blue;
font-size: x-large;
}
\ No newline at end of file
<?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';
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment