forked from vergnet/site-accueil-insa
.htpassdb + tentative map
This commit is contained in:
parent
3903101311
commit
a16f693a1a
3 changed files with 52 additions and 3 deletions
|
@ -4,6 +4,45 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="assets/map/map.js"></script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function get_map_info($selector)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT title, description FROM map_insa WHERE selector = ?';
|
||||||
|
$cursor = $this->conn->prepare($sql);
|
||||||
|
$cursor->execute([$selector]);
|
||||||
|
return $cursor->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_map_selectors()
|
||||||
|
{
|
||||||
|
$sql = 'SELECT selector FROM map_insa';
|
||||||
|
$cursor = $this->conn->prepare($sql);
|
||||||
|
$cursor->execute();
|
||||||
|
return $cursor->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_map_info($selector, $info_json)
|
||||||
|
{
|
||||||
|
$sql = 'DELETE FROM map_insa WHERE selector = ?';
|
||||||
|
$cursor = $this->conn->prepare($sql);
|
||||||
|
$cursor->execute([$selector]);
|
||||||
|
$sql = 'INSERT INTO map_insa (title, description, selector) VALUES (?, ?, ?)';
|
||||||
|
$cursor = $this->conn->prepare($sql);
|
||||||
|
$cursor->execute([$info_json['title'], $info_json['description'], $selector]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_in_map($selector) {
|
||||||
|
$sql = 'SELECT selector FROM map_insa WHERE selector = ?';
|
||||||
|
$query = $this->conn->prepare($sql);
|
||||||
|
$query->execute([$selector]);
|
||||||
|
return $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="maps_button">
|
<div id="maps_button">
|
||||||
<button onclick="enable3DMap()" class="main-button">Map 3D</button>
|
<button onclick="enable3DMap()" class="main-button">Map 3D</button>
|
||||||
<button onclick="enable2DMap()" class="main-button">Map 2D</button>
|
<button onclick="enable2DMap()" class="main-button">Map 2D</button>
|
||||||
|
@ -40,5 +79,3 @@ function enable2DMap() {
|
||||||
map.classList.remove("hidden");
|
map.classList.remove("hidden");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type='text/javascript' src='map.js'></script>
|
|
0
script/.htpassdb
Normal file
0
script/.htpassdb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
function read_password()
|
||||||
|
{
|
||||||
|
$real_path = __DIR__.DIRECTORY_SEPARATOR.".htpassdb";
|
||||||
|
$file = fopen($real_path, "r") or die("Unable to open DB password file!");;
|
||||||
|
$password = fgets($file);
|
||||||
|
fclose($file);
|
||||||
|
return trim($password);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = new PDO('mysql:host=127.0.0.1;dbname=accueil_insa','root', read_password());
|
||||||
|
?>
|
Loading…
Reference in a new issue