forked from Seitanas/kvm-vdi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapshot.php
29 lines (29 loc) · 866 Bytes
/
snapshot.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
<?php
include ('functions/config.php');
require_once('functions/functions.php');
if (!check_session()){
header ("Location: $serviceurl/?error=1");
exit;
}
slash_vars();
$vm=$_GET['vm'];
$hypervisor=$_GET['hypervisor'];
$action=$_GET['action'];
if (empty($vm)){
header("Location: $serviceurl/dashboard.php");
exit;
}
if ($action=="mass_on")
add_SQL_line("UPDATE vms SET snapshot='true' WHERE source_volume='$vm'");
if ($action=="mass_off")
add_SQL_line("UPDATE vms SET snapshot='false' WHERE source_volume='$vm'");
if ($action=="single"){
$snapshot=get_SQL_line("SELECT snapshot FROM vms WHERE id='$vm'");
if ($snapshot[0]=="true")
add_SQL_line("UPDATE vms SET snapshot='false' WHERE id='$vm'");
else
add_SQL_line("UPDATE vms SET snapshot='true' WHERE id='$vm'");
}
header("Location: $serviceurl/dashboard.php");
exit;
?>