mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-11-01 18:38:03 +00:00
33 lines
834 B
PHP
33 lines
834 B
PHP
<?php
|
|
|
|
if(!isset($_GET['jname'])){
|
|
echo 'You forgot to specify a name of jail!';
|
|
exit;
|
|
}
|
|
|
|
function runVNC($jname)
|
|
{
|
|
$res=(new Db('base','local'))->selectOne("SELECT vnc_password FROM bhyve WHERE jname=?", array([$jname]));
|
|
|
|
$pass='cbsd';
|
|
if($res!==false) $pass=$res['vnc_password'];
|
|
|
|
CBSD::run("vm_vncwss jname=%s permit=%s", array($_SERVER['REMOTE_ADDR']));
|
|
|
|
if(isset($_SERVER['SERVER_NAME']) && !empty(trim($_SERVER['SERVER_NAME']))){
|
|
$nodeip=$_SERVER['SERVER_NAME'];
|
|
} else {
|
|
$nodeip=$_SERVER['SERVER_ADDR'];
|
|
}
|
|
|
|
# TODO: This will send the pass in clear text
|
|
header('Location: http://'.$nodeip.':6081/vnc_auto.html?host='.$nodeip.'&port=6081?password='.$pass);
|
|
exit;
|
|
}
|
|
|
|
$rp=realpath('../');
|
|
require_once($rp.'/php/db.php');
|
|
require_once($rp.'/php/cbsd.php');
|
|
|
|
runVNC($_GET['jname']);
|