Caché les mdp. Les données récupérées sont mainenant jolies.

This commit is contained in:
Mysaa 2021-10-11 23:49:41 +02:00
parent 4af54d3715
commit bc6195600d
Signed by: Mysaa
GPG Key ID: DBA23608F23F5A10
3 changed files with 45 additions and 11 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
svg-pan-zoom.min.js svg-pan-zoom.min.js
tinycolor-min.js tinycolor-min.js
bddpass.php

View File

@ -1,8 +1,13 @@
<?php <?php
// Connection à la BDD: // Connection à la BDD:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include 'bddpass.php';
try { try {
$conn = new PDO("mysql:host=localhost;dbname=savrillo", savrillo, "BHTvo0JfS"); $conn = new PDO("mysql:host=localhost;dbname=savrillo", "savrillo", $bddpass, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
// set the PDO error mode to exception // set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) { } catch(PDOException $e) {
@ -30,7 +35,7 @@ if($_GET["salle"] != NULL) {
$resP = $stmt->fetchAll(); $resP = $stmt->fetchAll();
for($i=0;$i<count($resP);$i++) for($i=0;$i<count($resP);$i++)
$locataires[$i] = $resP[$i]['nom']; $locataires[$i] = $resP[$i]['personne'];
$stmt = $conn->prepare("SELECT id, nom, description FROM salles WHERE id=?"); $stmt = $conn->prepare("SELECT id, nom, description FROM salles WHERE id=?");

View File

@ -7,7 +7,12 @@
<style> <style>
#selectedSalleInfos { #selectedSalleInfos {
background-color: #888888; background-color: #BBBBBB;
line-height: 150%;
}
#selectedSalleInfos h2 {
display: inline;
} }
</style> </style>
@ -15,7 +20,7 @@
<body> <body>
<script type="text/javascript" src="./svg-pan-zoom.min.js"></script> <script type="text/javascript" src="./svg-pan-zoom.min.js"></script>
<script type="text/javascript" src="./tinycolor.min.js"></script> <script type="text/javascript" src="./tinycolor-min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -30,6 +35,17 @@
xmlHttp.send(null); xmlHttp.send(null);
} }
function putWaitNetworkScreen()
{
outputDiv.innerHTML = "Récupération des informations auprès du serveur...";
}
function salleInfosToHtml(salle) {
titres = "<h2>"+salle.nom+"</h2>"+((salle.aliaz.length!=0)?(" ou <h2>"+salle.aliaz.join("</h2> ou <h2>")+"</h2>"):"");
locataires = salle.locataires.join(", ");
return titres + ((salle.description!=null)?("\n<br/>\n" + salle.description):"") + ((salle.locataires.length!=0)?("\n<br/>\n<b>Locataires</b>: " + locataires):"");
}
function initSvgSupport() { function initSvgSupport() {
var plan = document.getElementById('plan'); var plan = document.getElementById('plan');
@ -48,13 +64,20 @@
} }
document.lastSelectedSalle = e.target; document.lastSelectedSalle = e.target;
window.clearTimeout(document.wnsTimeout);
document.wnsTimeout = window.setTimeout(putWaitNetworkScreen, 400);
httpGetAsync("https://perso.ens-lyon.fr/samy.avrillon/sallesQuery.php?salle="+e.target.id.substring("path-salle-".length),function (s,errcode){ httpGetAsync("https://perso.ens-lyon.fr/samy.avrillon/sallesQuery.php?salle="+e.target.id.substring("path-salle-".length),function (s,errcode){
window.clearTimeout(document.wnsTimeout);
try{ try{
if(s=="404"){
outputDiv.innerHTML = "Aucune information disponible pour cette salle. Si vous en avez, indiquez-les à l'adresse <a href=mailto:samy.avrillon@ens-lyon.fr>samy.avrillon@ens-lyon.fr</a> en indiquant l'identifiant de la salle : "+document.lastSelectedSalle.id.substring("path-salle-".length);
return;
}
ss = JSON.parse(s) ss = JSON.parse(s)
if(document.lastSelectedSalle.id==("path-salle-"+ss["id"])){ if(document.lastSelectedSalle.id==("path-salle-"+ss["id"])){
if(errcode==200){ if(errcode==200){
outputDiv.innerHTML = s; outputDiv.innerHTML = salleInfosToHtml(ss);
}else }else
outputDiv.innerHTML = "Erreur lors de l'appel à l'interface php: ERREUR "+errcode; outputDiv.innerHTML = "Erreur lors de l'appel à l'interface php: ERREUR "+errcode;
} }
@ -96,6 +119,8 @@
<option value="3">Troisième étage</option> <option value="3">Troisième étage</option>
<option value="4">Quatrième étage</option> <option value="4">Quatrième étage</option>
</select> </select>
|
<input type="button" value="Vue d'ensemble" id="overviewButton" onclick="overviewButton"/>
</form> </form>
@ -110,12 +135,14 @@
</object> </object>
<form>
<input name="searchString" type="text"/>
</form>
<div id="selectedSalleInfos"> <div id="selectedSalleInfos">
Il faut que vous sélectionnez une salle. Il faut que vous sélectionnez une salle.
</div> </div>
<form>
<input name="searchString" type="text"/>
</form>
</body> </body>
</html> </html>