doutouhe5343 2019-03-21 16:38
浏览 99

加载页面时显示几个进度条

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>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 MATLAB中streamslice问题
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序