Answer the question
In order to leave comments, you need to log in
How to stop an infinite loop in php?
Tell me what's wrong :(
function allServers() {
return [
[
'host' => '127.0.0.1',
'username' => 'root',
'pass' => 'root'
],
[
'host' => '127.0.0.1',
'username' => 'root',
'pass' => 'root'
],
];
}
case '/updateproxy': {
$allserver = allServers();
$good = 0;
for ($i = 0, $size = count($allserver); $i < $size; ++$i) {
$connection = ssh2_connect($allserver[$i]['host'], 22);
if (ssh2_auth_password($connection, $allserver[$i]['username'], $allserver[$i]['pass'])) {
$stream = ssh2_exec($connection, 'cd /root/1; sh proxy.sh;');
} else {
$good++;
break;
}
}
if ($good != 0){
botSend([
' На каком то из сервером возникла ошибка!',
], chatAdmin());
break;
}
$result = [' Прокси успешно обновлены!',];
botSend([
' Прокси успешно обновлены!',
], chatAlerts());
$flag = true;
break;
}
Answer the question
In order to leave comments, you need to log in
And if you change
for ($i = 0, $size = count($allserver); $i < $size; ++$i) {
to
for ($i = 0; $i < count($allserver); $i++ ) {
then what is the result? ;)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question