diff --git a/bureau/admin/vm.php b/bureau/admin/vm.php index 56680de1..39ee322b 100644 --- a/bureau/admin/vm.php +++ b/bureau/admin/vm.php @@ -1,21 +1,35 @@ <?php require_once("../class/config.php"); -include_once("head.php"); $fields = array ( "action" => array ("get", "string", ''), + "script" => array ("get", "boolean", 0), ); getFields($fields); if (in_array($action, array('start', 'stop', 'monit'))) { $res = $hooks->invoke($action, array(), 'lxc'); -printvar($res); } $infos = $lxc->getvm(); +if ($script) { + // FIXME afficher les variables pertinentes de manière pertinente pour quelqu'un qui veux scripter :) + print_r($infos); + if (isset($res)) print_r($res); + die(); +} + +# Show the header after the "if script" ;) +include_once("head.php"); + +# Debug +echo "<fieldset><legend>debug</legend>res<br/>"; +if (isset($res)) { printvar($res); } +echo "infos getvm"; printvar($infos); +echo "</fieldset>"; ?> <h3><?php __('Console access'); ?></h3> @@ -49,6 +63,24 @@ printvar($infos); } // empty infos ?> </div> +<br/> +<br/> +<hr/> +<br/> +<fieldset><legend><?php __("Tips");?></legend> +<?php __("You can script the launch the console access in command line by using this url:"); ?> +<pre> +http://<?php echo $mem->user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1&action=start' ?> +</pre> +<?php __("You can halt the vm by using:"); ?> +<pre> +http://<?php echo $mem->user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1&action=stop' ?> +</pre> +<?php __("And you can see existing vm informations (if exist) by using:"); ?> +<pre> +http://<?php echo $mem->user['login'].':ALTERNC_PASSWORD@'.$host.'/vm.php?http_auth=1&script=1' ?> +</pre> +</fieldset> <?php include_once("foot.php"); ?> diff --git a/bureau/class/m_lxc.php b/bureau/class/m_lxc.php index 6dca0497..64bb7ae8 100644 --- a/bureau/class/m_lxc.php +++ b/bureau/class/m_lxc.php @@ -90,7 +90,7 @@ class m_lxc implements vm $res = $this->sendMessage('start', $user, $pass, $uid); if ($res === FALSE) - return $this->error[0]; + return $this->error; else { $data = unserialize($res); diff --git a/bureau/class/m_mem.php b/bureau/class/m_mem.php index d3f3d00a..ac7c0c20 100644 --- a/bureau/class/m_mem.php +++ b/bureau/class/m_mem.php @@ -238,7 +238,7 @@ class m_mem { return false; } if ($_REQUEST["username"] && $_REQUEST["password"]) { - return $this->login($_REQUEST["username"],$_REQUEST["password"],$_REQUEST["restrictip"]); + return $this->login($_REQUEST["username"],$_REQUEST["password"], (isset($_REQUEST["restrictip"])?$_REQUEST["restrictip"]:0) ); } } // end isset $_COOKIE["session"]=isset($_COOKIE["session"])?addslashes($_COOKIE["session"]):"";