...
 
Commits (6)
......@@ -33,3 +33,30 @@ deploy:
- trap - EXIT
tags:
- linux
# Documemtation
# https://docs.gitlab.com/ee/ci/yaml/#artifacts
fab-artifacts:
script:
- set -e
- sed -i '/^\$servername/d' signalements/writebdd.php
- sed -i '/^\$username/d' signalements/writebdd.php
- sed -i '/^\$password/d' signalements/writebdd.php
- sed -i '/^\$dbname/d' signalements/writebdd.php
- sed -i "s/\$username, \$password, \$dbname/$dbuser, $dbpass, $dbuser/" signalements/writebdd.php
- sed -i '/^\$username/d' signalements/get_results.php
- sed -i '/^\$password/d' signalements/get_results.php
- sed -i '/^\$dbname/d' signalements/get_results.php
- sed -i "s/\$username, \$password, \$dbname/$dbuser, $dbpass, $dbuser/" signalements/get_results.php
- trap - EXIT
artifacts:
paths:
- ./
only:
- fablab
\ No newline at end of file
......@@ -97,8 +97,8 @@
{
// la connexion c'est bien passé
var racine = JSON.parse(xhr.responseText);
document.getElementById("nbusersThisBox").innerHTML=racine.resultat;
document.getElementById("nbusersThisBox").innerHTML=racine.this;
document.getElementById("nbusersAllBox").innerHTML=racine.all;
} // if(xhr.status==200)
}
}
......@@ -115,7 +115,6 @@
</head>
<body>
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0">
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="/">SafetyBox</a>
<input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
......@@ -155,6 +154,34 @@
<span data-feather="users"></span>
SafetyBoxes
</a>
<?php
// database
$servername = "localhost";
$username = "ledoc";
$password = "safetybox";
$dbname = "sinistres";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = 'SELECT DISTINCT mac FROM personne';
if ($query = $conn->query($sql)){
echo '<ul class="nav flex-column">';
while ($row = mysqli_fetch_array($query)) {
echo "<li>";
echo "<a class='nav-link' href='#'>";
echo "<span data-feather='users'></span>";
echo $row[0];
echo "</a>";
echo "</li>";
}
echo "</ul>";
}
// Close the database
$conn->close();
?>
</li>
<!-- <li class="nav-item">
<a class="nav-link" href="#">
......@@ -210,12 +237,12 @@
<div class="col-md-6 col-sm-6 col-xs-12 tile_stats_count">
<span class="count_top"><i class="fa fa-user"></i> Total inscrits sur cette SafetyBox</span>
<div class="count green" id="nbusersThisBox"></div>
<span class="count_bottom"><i class="green">4% </i> depuis 2 h</span>
<!-- <span class="count_bottom"><i class="green">4% </i> depuis 2 h</span> -->
</div>
<div class="col-md-6 col-sm-6 col-xs-12 tile_stats_count">
<span class="count_top"><i class="fa fa-clock-o"></i> Total inscrits sur toutes les SafetyBox <strong class="green">synchronisées</strong></span>
<div class="count" id="nbusersAllBox">500</div>
<span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>3% </i> depuis 2 min</span>
<div class="count" id="nbusersAllBox"></div>
<!-- <span class="count_bottom"><i class="green"><i class="fa fa-sort-asc"></i>3% </i> depuis 2 min</span> -->
</div>
<!-- <div class="col-md-2 col-sm-4 col-xs-6 tile_stats_count">
<span class="count_top"><i class="fa fa-user"></i> Total Males</span>
......
......@@ -46,17 +46,27 @@ function getEveryBodyrow($conn) {
}
function getNumPersonne($conn) {
$myfile = fopen("../../mac", "r") or die("Unable to open file!");
$MAC = trim(fgets($myfile)); // The fgets() function is used to read a single line from a file. so we read the first line
fclose($myfile);
$sql = 'SELECT id FROM personne';
if ($result = $conn->query($sql) ) {
$json = '{"resultat": "'.$result->num_rows.'"}'; // nombre de lignes
echo $json;
// printf("Result set has ".$result->num_rows);
$json = '{"all": "'.$result->num_rows.'"'; // nombre de lignes
}
$sql = 'SELECT * FROM personne WHERE mac="'.$MAC.'"';
if ($result = $conn->query($sql) ) {
$json.=',"mac": "'.$MAC.'"';
$json.= ',"this": "'.$result->num_rows.'"}'; // nombre de lignes
}
echo $json;
// echo '{"this": "'.$MAC.'"}';
}
// Close the database
$conn->close();
function getEveryBodyrowtab($conn) {
$sql = 'SELECT * FROM personne ORDER BY id';
......@@ -83,4 +93,7 @@ function cleanTable($conn){
// echo $sql . "<br>" . $e->getMessage();
// }
}
// Close the database
$conn->close();
?>