当前位置: 首页>>代码示例>>PHP>>正文


PHP Net_SSH2::setTimeout方法代码示例

本文整理汇总了PHP中Net_SSH2::setTimeout方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_SSH2::setTimeout方法的具体用法?PHP Net_SSH2::setTimeout怎么用?PHP Net_SSH2::setTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Net_SSH2的用法示例。


在下文中一共展示了Net_SSH2::setTimeout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSSH

 /**
  * Logs in to a SSH server with the specified credentials,
  * and returns the Net_SSH2 instance.
  *
  * @return 	Net_SSH2 $ssh 
  * @author 	Ronald Rey
  **/
 public static final function getSSH($host, $user, $pass, $timeout)
 {
     $ssh = new Net_SSH2($host);
     if (!$ssh->login($user, $pass)) {
         exit('Login to failed.');
     }
     $ssh->setTimeout($timeout);
     $ssh->write(" ");
     return $ssh;
 }
开发者ID:reyronald,项目名称:CiscoSSH,代码行数:17,代码来源:CiscoSSH.php

示例2: Exec

    public function Exec($command, $stdin = '')
    {
        $database = $this->session->getDatabase();
        $name = $database['name'];
        $engine = $this->session->getSpoolerByName($name, 'waae');
        if (!isset($engine[0]['shell'])) {
            print "?!";
            exit;
        }
        set_include_path('../vendor/phpseclib' . PATH_SEPARATOR . get_include_path());
        include 'Net/SSH2.php';
        include 'Crypt/RSA.php';
        $shell = $engine[0]['shell'];
        $host = $shell['host'];
        $user = $shell['user'];
        $ssh = new \Net_SSH2($host);
        if (isset($shell['key'])) {
            $key = new \Crypt_RSA();
            $ret = $key->loadKey($shell['key']);
            if (!$ret) {
                echo "loadKey failed\n";
                print "<pre>" . $ssh->getLog() . '</pre>';
                exit;
            }
        } elseif (isset($shell['password'])) {
            $key = $shell['password'];
        } else {
            $key = '';
            // ?! possible ?
        }
        if (!$ssh->login('autosys', $key)) {
            print 'Login Failed';
            print "<pre>" . $ssh->getLog() . '</pre>';
            exit;
        }
        if ($stdin == '') {
            return $ssh->exec(". ~/.bash_profile;{$command}");
        }
        // Test STDIN
        $ssh->enablePTY();
        print "profile" . $ssh->exec(". ~/.bash_profile");
        print "sort" . ($exec = $ssh->exec('sort'));
        $ssh->write(<<<EOF
echo "update_job: SE.ERIC.JOB.JobType_UNIX"
echo "description: 'ok!!'
EOF
);
        $ssh->reset(true);
        $ssh->setTimeout(2);
        print $ssh->read();
        return;
        return $ssh->read();
        // outputs the echo above
    }
开发者ID:AriiPortal,项目名称:ATSBundle,代码行数:54,代码来源:AriiExec.php

示例3: Verbinden

 /**
  * ???
  *
  * @param string[][] $data Die Serverdaten
  * @return ???
  */
 public static function Verbinden($data)
 {
     $ssh = null;
     if ($data['ZV']['zv_ssh_auth_type'] == 'passwd') {
         $ssh = new Net_SSH2($data['ZV']['zv_ssh_address']);
         $res = @$ssh->login($data['ZV']['zv_ssh_login'], $data['ZV']['zv_ssh_password']);
         if (!$res) {
             return null;
         }
         $ssh->setTimeout(0);
     } else {
         if ($data['ZV']['zv_ssh_auth_type'] == 'keyFile') {
             $ssh = new Net_SSH2($data['ZV']['zv_ssh_address']);
             $key = new Crypt_RSA();
             $key->loadKey(file_get_contents($data['ZV']['zv_ssh_key_file']));
             if (!$ssh->login($data['ZV']['zv_ssh_login'], $key)) {
                 return null;
             }
             $ssh->setTimeout(0);
         }
     }
     return $ssh;
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:29,代码来源:Zugang.php

示例4: flush

    echo ".";
    @ob_flush();
    flush();
}
$result = mysqli_query($con, "SELECT name,coind,gitsrc,cd_gitsrc,port_p2p,port_rpc FROM coind_templates WHERE id='" . $_POST['templateid'] . "'");
$coindinfo = mysqli_fetch_row($result);
$coindinfo['name'] = $coindinfo[0];
$coindinfo['coind'] = $coindinfo[1];
$coindinfo['gitsrc'] = $coindinfo[2];
$coindinfo['cd_gitsrc'] = $coindinfo[3];
$coindinfo['port_p2p'] = $coindinfo[4];
$coindinfo['port_rpc'] = $coindinfo[5];
$result2 = mysqli_query($con, "SELECT ip FROM servers WHERE id='" . $_POST['serverid'] . "'");
$serverinfo = mysqli_fetch_row($result2);
$serverinfo['ip'] = $serverinfo[0];
//log into server.,
$ssh = new Net_SSH2($serverinfo['ip']);
$key = new Crypt_RSA();
$key->loadKey(file_get_contents($sshkey_location));
if (!$ssh->login('root', $key)) {
    $debug[] = "SSH Login Failed!";
} else {
    $ssh->setTimeout(25);
    $debug['exec_fixutf8bug'] = $ssh->exec('su -c "export LC_ALL=\\"en_US.UTF-8\\"" -s /bin/sh ' . $_POST['username'], 'packet_handler');
    $cmd = "cd /home/" . $_POST['username'] . "/sauce/" . $coindinfo['cd_gitsrc'] . "/;";
    $cmd .= "./" . $coindinfo['coind'] . " -daemon &";
    $debug['exec_service'] = $ssh->exec('su -c "' . $cmd . '" -s /bin/sh ' . $_POST['username'], 'packet_handler');
    $debug['step'] = "Daemon Started! <a href=coinds.php>Enjoy your service.</a>";
}
mysqli_close($con);
print_r($debug);
开发者ID:newmight2015,项目名称:p2pmine-manager,代码行数:31,代码来源:coinds.add-do.step-FIN.php

示例5: getcwd

    $path = getcwd();
    set_include_path($path);
    @($query = mysqli_query($connect, "SELECT * FROM configureddb where dbuid='{$option}'"));
    while ($query_row = mysqli_fetch_assoc($query)) {
        $hostname = $query_row['server'];
        $sslusername = $query_row['sslusername'];
        $sslpassword = $query_row['sslpassword'];
    }
    set_include_path(get_include_path() . '/' . 'phpsec');
    include 'Net/SSH2.php';
    include 'File/ANSI.php';
    $ssh = new Net_SSH2(@$hostname);
    if (@$ssh->login(@$sslusername, @$sslpassword)) {
        $ssh->enablePTY();
        $ssh->exec('ps axo pid,ppid,%cpu,pmem,user,group,args --sort %cpu');
        $ssh->setTimeout(2);
        $hello = $ssh->read();
        $ps = explode("\n", $hello);
        $proc = array();
        foreach ($ps as $process) {
            $processes[] = preg_split('@\\s+@', trim($process), 7);
        }
        unset($processes[0]);
        foreach ($processes as $pro) {
            $proc[] = @array('pid' => $pro[0], 'ppid' => $pro[1], 'cpu' => $pro[2], 'pmem' => $pro[3], 'user' => $pro[4], 'group' => $pro[5], 'cmd' => $pro[6]);
        }
        echo json_encode($proc);
    } else {
        echo "[]";
    }
} else {
开发者ID:JKT-OSSCLUB,项目名称:ProActio,代码行数:31,代码来源:procutil.php

示例6: create_client_config_and_send

function create_client_config_and_send($cert_name, $config_dir, $config_file, $remote_value, $send_type, $key_dir_name)
{
    //will need phpseclib later.... so...
    if (!isset($_SESSION['password'])) {
        start_session('certs.php?action=send_cert&type=$send_type&cert_name=$cert_name');
    }
    $password = stripslashes(trim($_SESSION['password']));
    $username = stripslashes(trim($_SESSION['username']));
    if ($username == "") {
        $username = "root";
    }
    $ssh = new Net_SSH2('localhost');
    if (!$ssh->login($username, $password)) {
        exit('Login Failed');
    }
    //Creating a default client config file
    //TODO have a check to make sure /etc/openvpn.conf exists....
    //If none exists... then you should prolly do some checks when the webui is first launched.... duh
    if (!file_exists("openvpn-client-default.conf")) {
        create_default_client_config();
    }
    $vpn_config = read_openvpn_config($config_dir . $config_file);
    extract($vpn_config);
    echo "Default client file exists... <br />";
    echo "Now copying to new config {$cert_name}.conf<br />";
    copy("openvpn-client-default.conf", "{$cert_name}.conf");
    //New Conf file should exist.... Now edit specifics...
    if (file_exists("{$cert_name}.conf")) {
        $client_config = "{$cert_name}.conf";
        file_put_contents($client_config, "cert " . $cert_name . ".crt" . PHP_EOL, FILE_APPEND | LOCK_EX);
        file_put_contents($client_config, "key " . $cert_name . ".key" . PHP_EOL, FILE_APPEND | LOCK_EX);
    } else {
        echo "Error... client config file not found?<br />";
        exit;
    }
    //Finding what dir
    $curr_work_dir = getcwd();
    echo "Copying needed files...<br />";
    //Now copying all the necc. sh!t to the root folder... then zip it? tar it? idk.. prolly zip
    $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
    $ssh->write("cd {$key_dir_name};cp {$cert_name}.key {$ca_values['1']} {$cert_name}.crt {$curr_work_dir}\n");
    $result = $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
    echo "<pre>{$result}</pre>";
    //HAVE to change the permissions on *.key... or php can't touch it
    echo "Have to change permissions on the *.key file.. or php can't touch..<br />";
    $ssh->write("cd {$curr_work_dir};chmod 555 {$cert_name}.key\n");
    $result = $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
    echo "<pre>{$result}</pre>";
    echo str_repeat(' ', 1024 * 64);
    //create array of files to zip
    $files_to_zip = array("{$cert_name}.crt", "{$cert_name}.key", "{$ca_values['1']}", "{$cert_name}.conf");
    echo "Creating zip file <b>{$cert_name}.zip</b><br />";
    echo str_repeat(' ', 1024 * 64);
    $result = create_zip($files_to_zip, "{$cert_name}.zip", $cert_name);
    // unlink every other file...
    unlink("{$cert_name}.crt");
    unlink("{$cert_name}.key");
    unlink("{$ca_values['1']}");
    unlink("{$cert_name}.conf");
    if ($send_type == "download") {
        echo "<br /> Download transfer type selected!";
        echo "<br />";
        echo "Result:{$result}";
        echo str_repeat(' ', 1024 * 64);
        sleep(5);
        // return name of zip file, will use that to generate download link
        return $result;
        exit;
    }
    if ($send_type == "scp") {
        if (!isset($_SESSION['password'])) {
            start_session('certs.php?action=send_cert&type=$send_type&cert_name=$cert_name');
        }
        $password = stripslashes(trim($_SESSION['password']));
        $username = stripslashes(trim($_SESSION['username']));
        if ($username == "") {
            $username = "root";
        }
        $ssh = new Net_SSH2('localhost');
        if (!$ssh->login($username, $password)) {
            exit('Login Failed');
        }
        echo "SCP transfer type selected!";
        echo "TYPE TOO";
        echo str_repeat(' ', 1024 * 64);
        $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
        $ssh->write("cd {$curr_work_dir};scp {$cert_name}.zip {$username}@{$remote_host}:{$remote_dir}\n");
        $ssh->setTimeout(10);
        sleep(5);
        $result = $ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX);
        echo "<pre>{$result}</pre>";
        echo str_repeat(' ', 1024 * 64);
        exit;
    }
}
开发者ID:kimoduor,项目名称:OpenVPN-PHP-Management-Gui,代码行数:95,代码来源:functions.php

示例7: exit

//remote path variables to files
$remoteInputFile = "/code/spopt-stable/tests/" . $session . "/input.txt";
$remoteOutputFile = "/code/spopt-stable/tests/" . $session . "/input.txt.out";
$remoteSolutionsFile = "/code/spopt-stable/tests/" . $session . "/input.txt.solutions";
$remoteDiscardedFile = "/code/spopt-stable/tests/" . $session . "/input.txt.discarded";
//ssh2 and sftp used to remotely connect
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
include 'Net/SSH2.php';
include 'Net/SFTP.php';
//ssh connect to cr2g server
$ssh = new Net_SSH2('cr2g01.cs.utep.edu', 22);
if (!$ssh->login('rlgruver', 'utep$2015')) {
    exit('ssh Login Failed');
}
//attempted to set an ssh timeout, not allowed on UTEP server
$ssh->setTimeout(7200);
//sftp connect to cr2g server
$sftp = new Net_SFTP('cr2g01.cs.utep.edu', 22);
if (!$sftp->login('rlgruver', 'utep$2015')) {
    exit('sftp Login Failed');
}
//send input file to cr2g server
$sftp->mkdir('/code/spopt-stable/tests/' . $session);
$sftp->put($remoteInputFile, $localInputFile, NET_SFTP_LOCAL_FILE);
$sftp->chmod(0777, $remoteInputFile);
//execute python script in this order to run the Solver:
//1. change to directory where solver script is located
$ssh->write("cd /code/spopt-stable\n");
//2. 'read' command to ensure script is called from the proper directory
$ssh->read('rlgruver@cr2g01:/code/spopt-stable$');
//3. run the solver script with the test from the current session
开发者ID:rlgruver,项目名称:practicum,代码行数:31,代码来源:processOutput.php

示例8: server_connect

 public static function server_connect($sServer, $sAPI = 0)
 {
     $sSSH = new Net_SSH2($sServer->sIPAddress);
     if ($sServer->sPassword == 0) {
         $sKey = new Crypt_RSA();
         $sKey->loadKey(file_get_contents('/var/feathur/data/keys/' . $sServer->sKey));
     } else {
         $sKey = file_get_contents('/var/feathur/data/keys' . $sServer->sKey);
     }
     try {
         if (!$sSSH->login($sServer->sUser, $sKey)) {
             if (!empty($sAPI)) {
                 return $sResult = array("result" => 'Unable to connect to the host node, please contact customer service.');
             }
             echo json_encode(array("result" => 'Unable to connect to the host node, please contact customer service.'));
             die;
         } else {
             $sSSH->setTimeout(30);
             return $sSSH;
         }
     } catch (Exception $e) {
         if (!empty($sAPI)) {
             return $sResult = array("result" => 'Unable to connect to the host node, please contact customer service.');
         }
         echo json_encode(array("result" => 'Unable to connect to the host node, please contact customer service.'));
         die;
     }
 }
开发者ID:AstroProfundis,项目名称:Feathur,代码行数:28,代码来源:servers.class.php

示例9: addslashes

     $host_connected = false;
     $sql = "UPDATE sshManagerQueue\n\t\t\t\tSET cmdOutput = 'Auth failed!',\n\t\t\t\t\tcmdTimestamp = UNIX_TIMESTAMP()\n\t\t\t\tWHERE memberID = '" . $connection["memberID"] . "'\n\t\t\t\t  AND jobTemplateID = '" . $connection["jobTemplateID"] . "'\n\t\t\t\t  AND deviceID = '" . $connection["deviceID"] . "'\n\t\t\t\t  AND cmdID = '" . $connection["cmdID"] . "'";
     //echo "Running sql auth error cmdID: ".$connection["cmdID"]."\n$sql";
     if ($db_CS->query($sql)) {
     }
 } else {
     // WE GOT A CONNECTION !
     //$ansi->appendString($ssh->read('username@username:~$'));
     $ansi = new File_ANSI();
     $sql = "UPDATE sshManagerQueue\n\t\t\t\tSET cmdOutput = 'Connected!',\n\t\t\t\t\tcmdTimestamp = UNIX_TIMESTAMP()\n\t\t\t\tWHERE memberID = '" . $connection["memberID"] . "'\n\t\t\t\t  AND jobTemplateID = '" . $connection["jobTemplateID"] . "'\n\t\t\t\t  AND cmdID = '" . $connection["cmdID"] . "'\n\t\t\t\t  AND deviceID = '" . $connection["deviceID"] . "'";
     if ($db_CS->query($sql)) {
         if (strstr($cmdText, 'top')) {
             $ssh->enablePTY();
             //echo "found TOP in command list\n";
             $ssh->exec($cmdText);
             $ssh->setTimeout(5);
             //$ansi->appendString($ssh->read('username@username:~$'));
             $ansi->appendString($ssh->read());
             $response["cmdOutput"] = $ansi->getHistory();
         } else {
             $ssh->enablePTY();
             //echo "not found TOP in command list\nExecuting $cmdText \n";
             $ssh->exec($cmdText . "\n");
             //$ssh->setTimeout(5);
             $ansi->appendString($ssh->read());
             $response["cmdOutput"] = $ansi->getHistory();
             //$response["cmdOutput"] = $ssh->exec($cmdText);
         }
         //echo "Response: \n".$response["cmdOutput"];
         $sql = "UPDATE sshManagerQueue\n\t\t\t\t\tSET cmdOutput = '" . addslashes($response["cmdOutput"]) . "',\n\t\t\t\t\t\tcmdTimestamp = UNIX_TIMESTAMP()\n\t\t\t\t\tWHERE memberID = '" . $connection["memberID"] . "'\n\t\t\t\t\t  AND jobTemplateID = '" . $connection["jobTemplateID"] . "'\n\t\t\t\t\t  AND cmdID = '" . $connection["cmdID"] . "'\n\t\t\t\t\t  AND deviceID = '" . $connection["deviceID"] . "'";
         //echo "Running sql success cmdID: ".$connection["cmdID"]."\n$sql";
开发者ID:HomelessCoder,项目名称:sacp,代码行数:31,代码来源:sshManagerWorker.php

示例10: elseif

 $vsftpd .= "write_enable=YES\n";
 $vsftpd .= "local_enable=YES\n";
 $vsftpd .= "allow_writeable_chroot=YES\n";
 //SSL
 $vsftpd .= "rsa_cert_file=/etc/ssl/private/vsftpd.pem\n";
 $vsftpd .= "rsa_private_key_file=/etc/ssl/private/vsftpd.pem\n";
 $vsftpd .= "ssl_enable=YES\n";
 $vsftpd .= "allow_anon_ssl=NO\n";
 $vsftpd .= "ssl_tlsv1=YES\n";
 $vsftpd .= "ssl_sslv2=NO\n";
 $vsftpd .= "ssl_sslv3=NO\n";
 $vsftpd .= "require_ssl_reuse=NO\n";
 $vsftpd .= "ssl_ciphers=HIGH\n";
 $vsftpd .= "################\n";
 if ($os == "Debian 8 32bit") {
     $ssh->setTimeout(45);
     $ssh->exec('apt-get update');
     $ssh->exec('apt-get -y install sudo');
     $ssh->exec('apt-get -y install screen');
     $ssh->exec('apt-get -y install libtinfo5 libncurses5');
     $ssh->exec('apt-get -y install lib32stdc++6');
     $ssh->exec('apt-get -y install vsftpd');
     $ssh->exec('apt-get -y install unzip');
     $ssh->exec('apt-get -y install gawk');
     $ssh->exec("apt-get -y install openssl");
     $os_version = "Debian 8";
     $os_bit = "32";
 } elseif ($os == "Debian 8 64bit") {
     $ssh->exec('dpkg --add-architecture i386');
     $ssh->setTimeout(45);
     $ssh->exec('apt-get update');
开发者ID:sollidius,项目名称:Prometheus,代码行数:31,代码来源:rootserver.php

示例11: NewOrderPatient


//.........这里部分代码省略.........
        $instance = 'CPM355';
        $cprsLogin = 'S DUZ=1';
        $tmatch = trim($match);
        $patientSearch = $tmatch;
        $patientLocation = 'GEN MED';
        $actingProvider = 'v107';
        $doseorder = "" . $dose . " " . $Regimen_Dose_Unit . "";
        $schedule = 'QDAY';
        $routine = 'ROUTINE';
        $drug = '5-FU  FLUOROURACIL INJ,SOLN';
        $tdrug = trim($drug);
        $AC = '1radiologist';
        $VC = 'radiologist1';
        $Description = 'OutPatient';
        $ssh = new Net_SSH2($host);
        if (!$ssh->login($username, $password)) {
            exit('Login Failed');
        }
        $ssh->write("{$login}\r");
        $ssh->write("{$loginpass}\r");
        sleep(3);
        $ssh->write("{$AC}\r");
        $ssh->write("{$VC}\r");
        sleep(3);
        $ssh->write("\r");
        $ssh->write("AD\r");
        $ssh->write("FD\r");
        $ssh->write("{$patientSearch}\r");
        sleep(1);
        $ssh->write("{$patientLocation}\r");
        if ($Description === 'InPatient') {
            $ssh->write("15\r");
        } elseif ($Description === 'OutPatient') {
            $ssh->write("20\r");
        }
        $ssh->write("Provider, One\r");
        $ssh->write("1\r");
        sleep(1);
        sleep(1);
        $ssh->write("{$tdrug}");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("n");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$doseorder}");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("1");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$schedule}");
        $ssh->write("\r");
        sleep(1);
        if ($Description === 'InPatient') {
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("N");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$routine}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("\r");
            sleep(1);
            $ssh->write("P");
            $ssh->write("\r");
        } else {
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$NumberofDoses}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$NumberofDoses}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("0");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("C");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$routine}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("\r");
            sleep(1);
            $ssh->write("P");
            $ssh->write("\r");
        }
        //Set SSH Timeout
        $ssh->setTimeout(1);
        //Read Results
        $SSHresults = $ssh->read();
        echo $SSHresults;
        writeDebug($SSHresults, $tdrug, $patientSearch, $orderday);
    }
}
开发者ID:bciv,项目名称:COMS,代码行数:101,代码来源:VCFOrder.php

示例12: ProgressNote

function ProgressNote($note, $match)
{
    return;
    $orderday = date('m_d_Y');
    //Set Variables
    $host = '54.83.44.110';
    $username = 'vista';
    $password = '';
    $login = '1radiologist';
    $loginpass = 'radiologist1';
    $tmatch = trim($match);
    $patientSearch = $tmatch;
    $AC = '1radiologist';
    $VC = 'radiologist1';
    //$AC = 'CPRS1234';
    //$VC = 'CPRS4321$';
    //$Note = "Test Note";
    $ssh = new Net_SSH2($host);
    if (!$ssh->login($username, $password)) {
        exit('Login Failed');
    }
    sleep(4);
    $ssh->write("\r");
    sleep(3);
    $ssh->write("\r");
    $ssh->write("\r");
    sleep(3);
    $ssh->write("\r");
    $ssh->write("{$AC}\r");
    $ssh->write("{$VC}\r");
    sleep(3);
    $ssh->write("\r");
    $ssh->write("OE\r");
    $ssh->write("FD\r");
    $ssh->write("{$patientSearch}\r");
    sleep(1);
    $ssh->write("\r");
    sleep(1);
    $ssh->write("\r");
    sleep(1);
    $ssh->write("Notes\r");
    sleep(1);
    $ssh->write("NW\r");
    sleep(1);
    $ssh->write("N\r");
    sleep(1);
    $ssh->write("Primary Care General Note\r");
    sleep(1);
    $ssh->write("Yes\r");
    sleep(1);
    $ssh->write("Outpatient\r");
    sleep(1);
    $ssh->write("New\r");
    sleep(1);
    $ssh->write("Y\r");
    sleep(1);
    $ssh->write("N\r");
    sleep(1);
    $ssh->write("A\r");
    sleep(1);
    $ssh->write("Y\r");
    sleep(5);
    $ssh->write("{$note}\r");
    sleep(1);
    $ssh->write("\r");
    sleep(1);
    $ssh->write("\r");
    sleep(1);
    $ssh->write("{$VC}\r");
    sleep(1);
    $ssh->write("Radiologist, One\r");
    sleep(1);
    $ssh->write("\r");
    //Set SSH Timeout
    $ssh->setTimeout(1);
    //Read Results
    $SSHresults = $ssh->read();
    //echo $SSHresults;
    $xxx = 'nothing';
    //writeDebug($SSHresults,$note,$patientSearch,$xxx);
}
开发者ID:bciv,项目名称:COMS,代码行数:81,代码来源:WPN.php

示例13:

//log into server.,
$ssh = new Net_SSH2($serverinfo['ip']);
$key = new Crypt_RSA();
$key->loadKey(file_get_contents($sshkey_location));
if (!$ssh->login('root', $key)) {
    $debug[] = "SSH Login Failed!";
} else {
    $debug['exec_fixutf8bug'] = $ssh->exec('su -c "export LC_ALL=\\"en_US.UTF-8\\"" -s /bin/sh ' . $_POST['username'], 'packet_handler');
    if ($coindinfo['name'] == "vertcoin" || $coindinfo['name'] == "caishen") {
        //libdb mod
        echo "Fixing leveldb error";
        $debug['fix_leveldb_error'] = $ssh->exec('cd /home/' . $_POST['username'] . '/sauce/' . $coindinfo['cd_gitsrc'] . '/leveldb;chmod +x build*', 'packet_handler');
        echo "Fixed!<br>";
    }
    echo "Compiling source";
    $debug['stet_timeout'] = $ssh->setTimeout(3600);
    if ($coindinfo['name'] == "dogecoin") {
        //libdb mod
        $debug['autogen_fix'] = $ssh->exec('cd /home/' . $_POST['username'] . '/sauce;./autogen.sh', 'packet_handler');
        echo "[autgen_patch]";
        $debug['configure_fix'] = $ssh->exec('cd /home/' . $_POST['username'] . '/sauce;./configure', 'packet_handler');
        echo "[configure_patch]";
        $debug['make_file_fix'] = $ssh->exec('cd /home/' . $_POST['username'] . '/sauce;make', 'packet_handler');
    } else {
        $debug['make_file'] = $ssh->exec('cd /home/' . $_POST['username'] . '/sauce/' . $coindinfo['cd_gitsrc'] . ';make -f makefile.unix USE_UPNP=', 'packet_handler');
    }
    echo "Compiled!<br>";
}
mysqli_close($con);
print_r($debug);
echo '
开发者ID:newmight2015,项目名称:p2pmine-manager,代码行数:31,代码来源:coinds.add-do.step4.php

示例14: GetNDFLldf

function GetNDFLldf()
{
    //Set Variables
    //$host = '54.83.44.110';
    $host = $_SESSION['vista'];
    //$username = 'vista';
    $username = $_SESSION['sshusr'];
    $password = '';
    $login = 'cachemgr';
    //$loginpass = 'vistagold';
    $loginpass = $_SESSION['sshpwd'];
    $csession = 'csession cache355';
    $ssh = new Net_SSH2($host);
    if (!$ssh->login($username, $password)) {
        exit('Login Failed');
    }
    $ssh->write("{$login}\r");
    $ssh->write("{$loginpass}\r");
    sleep(3);
    $ssh->write("CPRS1234\r");
    $ssh->write("CPRS4321\$\r");
    sleep(3);
    $ssh->write("\r");
    $ssh->write("FM\r");
    $ssh->write("Other\r");
    $ssh->write("RX\r");
    $ssh->write("PSN\r");
    $ssh->write("RPRT\r");
    $ssh->write("LDF\r");
    $countr = 0;
    while ($countr <= 1000) {
        $ssh->write("\r");
        $countr++;
    }
    sleep(1);
    //Set SSH Timeout
    $ssh->setTimeout(1);
    //Read Results
    $SSHresults = $ssh->read();
    $txtremove = array("[H[J[2J[H                                                      LOCAL DRUG LIST (ALPHABETI\nC)#   Not on National Formulary\n  R   National Formulary Restriction\n   \nLOCAL DRUG NAME                                   INACTIVE               DEA\n                                                                                \n    NDC                                             DATE");
    $SSHresultsNew = str_replace($txtremove, "", $SSHresults);
    $myFile = writeDrugFile($SSHresultsNew);
    $lineNum = 1;
    $count = 1;
    while ($count <= 194) {
        delLineFromFile($myFile, $lineNum);
        $count++;
    }
    $lineNum2 = 12741;
    $count2 = 1;
    while ($count2 <= 151) {
        delLineFromFile($myFile, $lineNum2);
        $count2++;
    }
    //Delete SQL
    $Dquery = "DELETE FROM LookUp WHERE Lookup_Type = 2";
    $DelDrugs = sqlsrv_query($conn, $Dquery);
    $str = file_get_contents($myFile);
    $array = preg_split('/[\\n\\r]+/', $str);
    foreach ($array as $i => $value) {
        $prefix = " ";
        $val = str_startswith($value, $prefix);
        if ($val === true) {
        } else {
            $prefix = "ZZ";
            $val = str_startswith($value, $prefix);
            if ($val === true) {
            } else {
                include "dbitcon.php";
                //$query = "INSERT INTO COMS_Drugs (Drugs) VALUES ('$value')";
                $query = "INSERT INTO LookUp (Lookup_Type,Name,Description) VALUES (2,'{$value}','NLM')";
                $postDrugs = sqlsrv_query($conn, $query);
            }
        }
    }
    file_put_contents($myFile, "{$str}");
    echo "Text file created and database entries updated in Lookup table for LookupType 2.";
}
开发者ID:bciv,项目名称:COMS,代码行数:78,代码来源:VCFDrugs.php

示例15: NewOrderPatient


//.........这里部分代码省略.........
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } elseif ($tdrug === 'RANITIDINE TAB') {
            $ssh->write("RANITIDINE TAB ");
            /* Block below vvvvvvvvvvvvvvvvvv changed to match Sandbox - 30 May 2014 */
            $ssh->write("\r");
            sleep(1);
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } elseif ($tdrug === 'DEXAMETHASONE TAB') {
            $ssh->write("DEXAMETHASONE TAB");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("n");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$doseorder} MG");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } elseif ($tdrug === 'PROCHLORPERAZINE TAB') {
            $ssh->write("PROCHLORPERAZINE TAB");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("n");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$doseorder} MG");
            /* Block above ^^^^^^^^^^^^^^^^^^^^^^^ changed to match Sandbox - 30 May 2014 */
            $ssh->write("\r");
            sleep(1);
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
        } else {
            $ssh->write("{$tdrug}");
            $ssh->write("\r");
            sleep(1);
        }
        $ssh->write("n");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$doseorder}");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("1");
        $ssh->write("\r");
        sleep(1);
        $ssh->write("{$schedule}");
        $ssh->write("\r");
        sleep(1);
        if ($Description === 'InPatient') {
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("N");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$routine}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("\r");
            sleep(5);
            $ssh->write("P");
            $ssh->write("\r");
        } else {
            $ssh->write("1");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$NumberofDoses}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$NumberofDoses}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("0");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("C");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("{$routine}");
            $ssh->write("\r");
            sleep(1);
            $ssh->write("\r");
            sleep(1);
            $ssh->write("P");
            $ssh->write("\r");
        }
        //Set SSH Timeout
        $ssh->setTimeout(1);
        //Read Results
        $SSHresults = $ssh->read();
        writeDebug($SSHresults, $tdrug, $patientSearch, $orderday);
    }
}
开发者ID:bciv,项目名称:COMS,代码行数:101,代码来源:NWPatient.php


注:本文中的Net_SSH2::setTimeout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。