I'm here because I have a problem displaying several progress bars when viewing my page. (I have no problem displaying one with the value of the user's disk)
These progress bars track the amount of data used for a user. In other words, if a user is connected and has two systems, he has 2 identifiers. The goal is for the page to trace the space used for identifier 1 and to trace a second bar for identifier2. I already know that you have to use different ids on the progress bar but I don't understand at all how to do that...
The PHP file that should be loaded by AJAX This script doesn't have problem. Values are hardcoded for example
<?php
$identifiant = 'id1';
$ip = '144.2.112.25';
$port = '22';
//Les variables sont visibles ici bien sur! , elle viennent d'une requete ajax jquery
$connection_string = ssh2_connect($ip, $port);
// $connection_string = ssh2_connect('127.0.0.1', 22);
if (@ssh2_auth_password($connection_string, 'root', 'MDP'))
{
}
else
{
throw new Exception("Authentication failed!");
echo'Connexion échouée, le serveur est surement down ! ';
}
$stream = ssh2_exec($connection_string, 'php /var/www/base/autre.php '.$identifiant);
stream_set_blocking($stream, true);
$stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
echo stream_get_contents($stream_out);
?>
:
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="70"
aria-valuemin="0" aria-valuemax="100" style="width:70%">
<span class="sr-only">70% Complete</span>
</div>
</div>
And on the distant serveur there is this script wich is executed by "autre.php"
<?php
$identifiant = $_GET['identifiant'];
$variable = shell_exec("df -h | grep ".$identifiant." | awk '{print $4}'");
var_dump($variable);
//Sert juste à tester si il arrive à lire ma variable $identifiant au final
file_put_contents("/var/www/base/jesuisuntest", $variable, FILE_APPEND);
?>
This script have to return the value of space to the progress bar
So if someone understand my problem and know how to resolve it.. (I don't have send the ajax because mine is only working with one progress bar) Thanks for all
</div>