PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
PanK
Forum Commoner
Posts: 36 Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada
Post
by PanK » Mon Nov 22, 2004 1:28 pm
I there anyway that thew entered command in the form will run, when I'm trying to prnt entered value using echo? Here is the example of the form:
Code: Select all
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Echo test</title>
</head>
<body>
<p> Entered value dispayed here:
<?
if(isset($testecho))
{
echo $testecho;
}
?>
</p><br>
<form action="testecho.php" method="get">
<input type="text" name="testecho">
<input type="submit" value="enter" name="enter">
</form>
</body></html>
I have a website and a few pictures were missing from it. Could it be erased writing something in the form?
Last edited by
PanK on Mon Nov 22, 2004 3:05 pm, edited 5 times in total.
MarK (CZ)
Forum Contributor
Posts: 239 Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:
Post
by MarK (CZ) » Mon Nov 22, 2004 1:32 pm
Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Echo test</title>
</head>
<body>
<p> Entered value dispayed here:
<?
if (isset($_GET["testecho"])) {
echo $_GET["testecho"];
}
?>
</p><br>
<form action="testecho.php" "method=get">
<input type="text" name="testecho">
<input type="submit" value="enter" name="enter">
</form>
</body>
</html>
1) Depending on you register_globals configuration, you may have to use $_GET, $_POST etc. vars
2) You forgot some quotes in <form> tag
3) Use
PanK
Forum Commoner
Posts: 36 Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada
Post
by PanK » Mon Nov 22, 2004 1:38 pm
Actyally my question was: is it possible to run a command, for example if in the form I enter something like phpinfo(); it will run this command?
rehfeld
Forum Regular
Posts: 741 Joined: Mon Oct 18, 2004 8:14 pm
Post
by rehfeld » Mon Nov 22, 2004 1:47 pm
use exec()
be carefull though
EDIT- sorry, i was day dreaming and typed exec, i meant eval()
Last edited by
rehfeld on Mon Nov 22, 2004 2:06 pm, edited 1 time in total.
PanK
Forum Commoner
Posts: 36 Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada
Post
by PanK » Mon Nov 22, 2004 1:50 pm
I'll put question differently. How should I enter comand in the form, to makeit run, if it outputs with echo?
MarK (CZ)
Forum Contributor
Posts: 239 Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:
Post
by MarK (CZ) » Mon Nov 22, 2004 1:51 pm
PanK wrote: Actyally my question was: is it possible to run a command, for example if in the form I enter something like phpinfo(); it will run this command?
For php commands (like phpinfo(); ) you'd [php_man]eval[/php_man] function.
evilmonkey
Forum Regular
Posts: 823 Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada
Post
by evilmonkey » Mon Nov 22, 2004 6:23 pm
Rasmus Ledorf wrote: If eval() is the answer, you're almost certainly asking the wrong question. -- Rasmus Lerdorf, BDFL of PHP
Keep that in mind. (that was a user comment in the php manual)