Ver Mensaje Individual
  #7 (permalink)  
Antiguo 21/05/2013, 19:21
AprendizX
 
Fecha de Ingreso: febrero-2013
Mensajes: 11
Antigüedad: 11 años, 2 meses
Puntos: 0
Respuesta: Como insertar variable dentro de un comando

Lo dicho... lo más obvio y ha hecho que esté hasta las 3:30 am española buscando la solución..


Muchas gracias por la ayuda ofrecida, es una lección que nunca olvidaré.


El codigo resultante , y por tanto funcional y correcto es :

Código PHP:
<?php

set_include_path
(get_include_path() . PATH_SEPARATOR 'phpseclib');
 
include(
'Net/SSH2.php');
include(
'conexion.php');
include(
'comprobar.php');


$consulta mysql_query("SELECT * FROM usuarios WHERE idusuario='$userid' " );

  while (
$row mysql_fetch_array($consulta)) {
$username$row['vpsuser'];
$host $row['vpsip'];
$password $row['vpspass'];
}


$comando"cd /home/$username/carpeta; mkdir test";








$ssh = new Net_SSH2($host); 
if (!
$ssh->login($username$password)) { 
    exit(
'Login Failed');
}


echo 
$ssh->exec($comando);

mysql_close($con);

?>