Re: Tomar Valor De Un Formulario.
| From: | Antonio Salom | Date: | Thu, 31 May 2001 15:56:07 +0000 |
| Subject: | Re: Tomar Valor De Un Formulario. | ||
| References: | 1 2 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-10763@lists.php.net to get a copy of this message | ||
El Jue 31 May 2001 15:22, Alberto Ferrer escribiste:
> -AzTk- Alejandro Galindo wrote:
> > esta mal tu html, aqui te lo mando arreglado
> >
> > <!doctype html public "-//W3C//DTD HTML 4.0 //EN">
> > <html>
> > <head>
> > <title>PHP Exec!</title>
> > </head>
> > <body>
> > <center>
> > <form action=Exec.php method=get>
> > <input type=text name="valor">
> > <input type=submit value="Entrar!" name="exec">
> > </center>
> > </body>
> > </html>
> >
> > y el php debe de ser asi
> >
> > <?php
> > if ($exec) {
Si en $valor esta el parametro que le quieras pasar... (configuración php).
El error está aquí. Si pones comillas simples el interprete escribe la
cadena tal cual sin tener en cuenta $valor. Para ello tienes que escribir
comillas dobles:
"ls $valor" o también 'ls '.$valor
PD: Debes tener cuidado cuando utilizas exec ya que puedes hacer temblar la
seguridad de todo el sistema y no solo de tu web. Por otro lado, si utilizas
las funciones de php para tratar ficheros, te irá mejor, ya que crearás una
aplicación portable (funciona también en windows y otros sistemas).
> > $line1 = exec('ls $valor', $output, $error);
> > while (list(,$line) = each($output)){
> > echo $line, "<BR>\n";
> > }
> > if ($error){
> > echo "Unix error code: $error<BR>\n";
> > exit;
> > }
> > }
> >
> > ?>
> >
> >
> > --- Alberto Ferrer - Barra Home <root@barrahome.com> escribió: > como
> > hago para que este script tome la variable 4valor que le
> >
> >> coloque.
> >> Aca ta lo que hice , debe funcionar pedo no anda.
> >> <?php
> >> $line1 = exec('ls $valor', $output, $error);
> >> while (list(,$line) = each($output)){
> >> echo $line, "<BR>\n";
> >> }
> >> if ($error){
> >> echo "Unix error code: $error<BR>\n";
> >> exit;
> >> }
> >>
> >>
> >> ?>
> >>
> >> y este es el que emite el valor
> >> <!doctype html public "-//W3C//DTD HTML 4.0 //EN">
> >> <html>
> >> <head>
> >> <title>PHP Exec!</title>
> >> <form action =Exec.php method=get>
> >> <input type=text name=valor>
> >> <input type=submit value="Entrar!">
> >> </center>
> >> </body>
> >> </html>
> >>
> >> </head>
> >> <body>
> >>
> >> </body>
> >> </html>
> >> Alberto Ferrer
> >> ICQ.: 117204246
> >> root@barrahome.com
> >> http://www.barrahome.com
> >> The PHP Spanish Group
> >
> > =====
> > AzTk (Alejandro Galindo)
> > ------------------------------------------------
> > "Yo no sufro de locura...la disfruto a cada minuto. "
> > ------------------------------------------------
> > México, D.F.
> > tel: 199-80860 / cel: 5455-8875 / icq: 43139078
> >
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Construye tu página personal en Yahoo! GeoCities. ¡Es fácil,
> > rápido y gratis! http://geocities.yahoo.com.mx
> >
> > ---------------------------------------------------------------------
> > Archivo On-line: http://www.phpes.com/
> > Manual PHP en español: http://www.php.net/manual/es/
> > Para dar de baja la suscripción, mande un mensaje a:
> > lista-unsubscribe@phpes.com
>
> no anda men no me hace ls -a ni -l ocea no hace nada
>
>
> ---------------------------------------------------------------------
> Archivo On-line: http://www.phpes.com/
> Manual PHP en español: http://www.php.net/manual/es/
> Para dar de baja la suscripción, mande un mensaje a:
> lista-unsubscribe@phpes.com
--
Antonio Salom Palliser