$sum = 0;
while ($result = mysqli_fetch_array($query)){
echo $result['balance'].'<br>';
$sum += $result['balance'];
}
echo $sum / 5;
# which php
/usr/bin/php
* * * * /usr/bin/php /var/www/....
if (file_exists("all/$page.php"))
include "all/$page.php";
else if ($_SESSION['id'] and file_exists("auth/$page.php"))
include "auth/$page.php";
else if (!$_SESSION['id'] and file_exists("guest/$page.php"))
include "guest/$page.php";
else if ($_SESSION['admin'] and file_exists("admin/$page.php"))
include "admin/$page.php";
else if (is_numeric($page)) {
$_SESSION['ref'] = $page;
location('register');
}
else
exit('Страница 404');
function parse ($url)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($curl);
return $result;
}
echo parse('https://sofifa.com/');
$orderapi = 7690218;
$result = json_decode('{"orders":{"7690218":{"id":"7690218","obj":"wall35173603_613","act":"vk_like","status":"works","timeout":"10","count":"5","count_good":"0","start":"16:21 06.09.2018","criterion":"no"}}}');
$status = $result->orders->$orderapi->status; // works
$count_good = $result->orders->$orderapi->count_good; // 0
RewriteEngine On
RewriteBase /
# Если запрошенный URL не является файлом на сервере...
RewriteCond %{REQUEST_FILENAME} !-f
# ...и если он также не является папкой, то...
RewriteCond %{REQUEST_FILENAME} !-d
# Перенаправляем запрос на index.php
RewriteRule ^(.*)$ index.php/$1 [L]