diff --git a/README.md b/README.md index 2505e79..1c7f358 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Because php-gtk is such a pain to compile on Windows, I've put together this pac * php5-mysql * php5-postgresql * php5-sqlite + * php5-ssh2 * Run via terminal in the OpenSQLManager folder using `php index.php` ## PHP Requirements diff --git a/sys/common/ssh.php b/sys/common/ssh.php new file mode 100644 index 0000000..99418af --- /dev/null +++ b/sys/common/ssh.php @@ -0,0 +1,60 @@ +session =& ssh2_connect($host, $port); + + if($this->session === FALSE) + { + return FALSE; + } + + return $this; + } + + /** + * Create a tunnel using the current ssh connection + * + * @param string $host + * @param int $port + * @param string $auth_type + * @param array $auth_params + * @return stream + */ + public function tunnel($host, $port, $auth_type='password', $auth_params) + { + if($auth_type === 'password') + { + ssh2_auth_password(&$this->session, $auth_params['user'], $auth_params['pass']); + } + + $this->stream =& ssh2_tunnel(&$this->session, $host, $port); + + return $this->stream; + } +} \ No newline at end of file