<?php
$str = file_get_contents ('https://minebrix.com/api.php?ip=95.217.219.25&port=19132');
$playersonline = json_decode($str, true);
$isOnline = $playersonline['online'];
if($isOnline){
$progressbar_online_color="#00bfeb";
}else{
$progressbar_online_color="#00bfeb";
}
?>
<div class="info">
<b id="ip"><?php echo $config['servers'][$i]['host']; ?>:<?php echo $config['servers'][$i]['port']; ?></b>
<?php if (isset($config['servers'][$i]['showMonitoring']) && $config['servers'][$i]['showMonitoring'] === true) { ?> Сейчас играет
<?php
$str = file_get_contents ('https://minebrix.com/api.php?ip=95.217.219.25&port=19132');
$playersonline = json_decode( $str );
if($isOnline){
$players_online_now = $playersonline->players->now; // текущее кол-во игроков
$players_online_max = $playersonline->players->max; // максимальное кол-во игроков
$players_online_percentage = round($playersonline->players->now/$players_online_max); // текущее/максимальное кол-во игроков в %
?>
<div>Сейчас играет</div>
<div class="bg-style">
<div>
<div class="counter" data-cp-percentage="<?php echo $players_online_percentage; ?>" data-cp-color="<?php echo $progressbar_online_color;?>"> </div>
</div>
</div>
<?php
}else{
$players_online_percentage=0;
?>
<div>Сервера остановлены</div>
<div class="bg-style">
<div>
<div class="counter" data-cp-percentage="<?php echo $players_online_percentage; ?>" data-cp-color="<?php echo $progressbar_online_color;?>"> </div>
</div>
</div>
<?php
}
?>
$players_online_percentage = round($playersonline->players->now/$players_online_max);
$players_online_percentage = round($playersonline->players->now/$players_online_max*100);
var_dump($playersonline->players);
<?php
$str = file_get_contents ('https://minebrix.com/api.php?ip=95.217.219.25&port=19132');
$playersonline = json_decode($str, true);
$isOnline = $playersonline['online'];
if($isOnline){
$progressbar_online_color="#00bfeb";
}else{
$progressbar_online_color="#00bfeb";
}
?>
<div class="info">
<b id="ip"><?php echo $config['servers'][$i]['host']; ?>:<?php echo $config['servers'][$i]['port']; ?></b>
<?php if (isset($config['servers'][$i]['showMonitoring']) && $config['servers'][$i]['showMonitoring'] === true) { ?> Сейчас играет
<?php
$str = file_get_contents ('https://minebrix.com/api.php?ip=95.217.219.25&port=19132');
$playersonline = json_decode( $str );
$players_online_now = $playersonline->players->now; // текущее кол-во игроков
$players_online_max = $playersonline->players->max; // максимальное кол-во игроков
$players_online_percentage = round($playersonline->players->now/$players_online_max); // текущее/максимальное кол-во игроков в %
?>
<div>Сейчас играет</div>
<div class="bg-style">
<div>
<div class="counter" data-cp-percentage="<?php echo $players_online_percentage; ?>" data-cp-color="<?php echo $progressbar_online_color;?>"> </div>
</div>
</div>
<?php
$str = file_get_contents ('https://minebrix.com/api.php?ip=95.217.219.25&port=19132');
$playersonline = json_decode($str, true);
$isOnline = $playersonline['online'];
if($isOnline){
$progressbar_online_color="#00bfeb";
echo '<img class="logo" src="./assets/img/ico-online.png" title="Сервер работает">';
}else{
$progressbar_online_color="#00bfeb";
echo '<img class="logo" src="./assets/img/ico-offline.png" title="Сервер выключен">';
}
?>
<div class="info">
<b id="ip">
<?php echo $config['servers'][$i]['host']; ?>:<?php echo $config['servers'][$i]['port']; ?>
</b>
<?php
if (isset($config['servers'][$i]['showMonitoring']) && $config['servers'][$i]['showMonitoring'] === true) {
?>
<?php
$str = file_get_contents ('https://minebrix.com/api.php?ip=95.217.219.25&port=19132');
$playersonline = json_decode( $str );
$players_online_now = $playersonline->players->now; // текущее кол-во игроков
$players_online_max = $playersonline->players->max; // максимальное кол-во игроков
$players_online_percentage = round($players_online_now/$players_online_max); // текущее/максимальное кол-во игроков в %
?>
<div>Сейчас играет</div>
<div class="bg-style">
<div>
<div class="counter" data-cp-percentage="<?php echo $players_online_percentage; ?>" data-cp-color="<?php echo $progressbar_online_color;?>"> </div>
</div>
</div>
<?php
}
?>
</div>
if($isOnline){
$progressbar_online_color="#00bfeb";
echo '<img class="logo" src="./assets/img/ico-online.png" title="Сервер работает">';
}else{
$progressbar_online_color="#00bfeb";
echo '<img class="logo" src="./assets/img/ico-offline.png" title="Сервер выключен">';
}
<?php echo round($playersonline->players->now/$переменная_с_макс_допустимым_кол_вом_игроков); ?>
- только туда подразумеваются проценты, а у вас на сервере может быть больше 100 игроков, возможноround($playersonline->players->now/$переменная_с_макс_допустимым_кол_вом_игроков)
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<pre>
toys:
- id: 1
name: boat
status: broken
status_updated: 2018-03-19
games:
- id: 1
note: need repair
- id: 14
note: boat is broken
- id: 7
name: Teddy bear
status: ok
status_updated: 2018-03-30
games:
-id: 5
note: bear feels well
- id: 43
name: octopus
status: ok
status_updated: 2018-03-19
games:
- id: 5
note: felt rather good though had no water to swim
- id: 14
note: two tentacles are lost
</pre>
</body>
</html>
<div class="container">...</div>
<div class="row">...</div>
<div class="col-sm-12 col-md-6 ..."></div>
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-6 ...">Текст первой колонки</div>
<div class="col-sm-12 col-md-6 ...">Текст второй колонки</div>
<div class="col-sm-12 col-md-6 ...">Текст третьей колонки</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-6 ...">
<div class="col-12">Текст первой колонки
<div class="col-sm-12 col-md-6 ...">Текст второй колонки</div>
<div class="col-sm-12 col-md-6 ...">Текст третьей колонки</div>
</div>
</div>
</div>
</div>
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width">
<title></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
</head>
<?php
require_once 'config.php';
$sql = "SELECT * FROM products";
$stmt = $pdo->prepare($sql);
$stmt->execute();
?>
<body>
<div class="container-fluid">
<div class="row">
<?php
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo '<div class="col-sm-12 col-md-6 col-lg-4 col-xl-3">';
echo '<div>' . $row['product_id'] . '</div>';
echo '<div>' . $row['product_name'] . '</div>';
echo '<div>' . $row['price'] . '</div>';
echo '<div>' . $row['opis'] . '</div>';
echo '<div>' . $row['socs'] . '</div>';
echo '<div>' .
'<img src = "data:image/png;base64,' . base64_encode($row['product_image']) . '" width = "250px" height = "250px"/>'
. '</div>';
echo '</div>';
}
?>
</div>
</div>
</body>
</html>
поможет regex