1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| <?php
var_dump(extension_loaded('ssh2'));
if (!function_exists("ssh2_connect"))
die("function ssh2_connect doesn't exist");
else
echo "<script>alert('ssh2_connect existe')</script>" ;
// if(!($con = ssh2_connect("10.107.7.91", 22)))
{
// echo "fail: unable to establish connection\n";
}
// else
// echo " connection reussite au serveur SSH !!" ;
//echo "connexion ssh reussite" ;
// else {
// try to authenticate with username root, password secretpassword
// if(!ssh2_auth_password($con, "user", "acme")) {
//if(!ssh2_auth_password($con, "user", "acme")) {
// echo "fail: unable to authenticate\n";
//} else {
// allright, we're in!
// echo "okay: logged in...\n";
// execute a command
// if (!($stream = ssh2_exec($con, "ls -al" ))) {
// echo "fail: unable to execute command\n";
//} else {
// collect returning data from command
// stream_set_blocking($stream, true);
//$data = "";
// while ($buf = fread($stream,4096)) {
// $data .= $buf;
//}
// fclose($stream);
//}
//}
//}
//}
?> |
Partager