You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
468 B
PHTML
21 lines
468 B
PHTML
5 years ago
|
<?php
|
||
|
/* SSH Connection Functions */
|
||
|
function ssh_Connect($server_ip, $username, $password) {
|
||
|
global $data;
|
||
|
$connection = new Net_SSH2($server_ip);
|
||
|
if (!$connection->login($username, $password)) {
|
||
|
return 2;
|
||
|
}
|
||
|
return $connection;
|
||
|
}
|
||
|
|
||
|
function ssh_sendCommand($connection, $command) {
|
||
|
ob_start();
|
||
|
//Hier wird das echo eingefangen und in die variable gespeichert.
|
||
|
echo $connection->exec($command);
|
||
|
$data = ob_get_contents();
|
||
|
ob_end_clean();
|
||
|
return $data;
|
||
|
}
|
||
|
?>
|