forked from Seitanas/kvm-vdi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vm_screen.php
54 lines (51 loc) · 1.67 KB
/
vm_screen.php
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
<?php
/*
KVM-VDI
Tadas Ustinavičius
tadas at ring.lt
Vilnius University.
Center of Information Technology Development.
Vilnius,Lithuania.
2015-12-23
*/
include ('functions/config.php');
require_once('functions/functions.php');
if (!check_session()){
header ("Location: $serviceurl/?error=1");
exit;
}
$vm=addslashes($_GET['vm']);
$hypervisor=addslashes($_GET['hypervisor']);
if (empty($vm)||empty($hypervisor)){
exit;
}
$h_reply=get_SQL_line("SELECT * FROM hypervisors WHERE id='$hypervisor'");
$v_reply=get_SQL_line("SELECT * FROM vms WHERE id='$vm'");
ssh_connect($h_reply[2].":".$h_reply[3]);
$address=ssh_command("sudo virsh domdisplay " . $v_reply[1], true);
$address=str_replace("localhost",$remote_spice_substitute[$h_reply[2]],$address);
$rnd=uniqid();
set_lang();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title><?php echo _("VM screen");?></title>
</head>
<body>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title"><?php echo _("VM name: ") . $v_reply[1]; ?></h4>
</div>
<div class="modal-body">
<?php echo '<img src="screenshot.php?vm=' . $vm . '&hypervisor=' . $hypervisor . '&' . $rnd . '">'; ?>
</div>
<div class="modal-footer">
<?php echo '<a class="btn btn-info" type="button" href="' . $address . '" target="_new">' . _("Open remote console") . '</a>';?>
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _("Close");?></button>
</div>
</div>
</body>
</html>