Here is a PHP interpreter on a web page.  I wrote it to help me learn PHP 
and it was very helpful.  Just copy the code below to a web page, like 
"eval.php".

WARNING!  If you put this code on a public server, you should change the 
hardcoded password (BULLDOG) to something non-obvious, otherwise a hacker 
could use it to mess with your server.

--------------- cut here ----------------
<?php

echo "<body onload='window.f.expr.select()'>";
echo "<ul><li>Type a PHP expression.<li>Do not use single quotes.";
echo "<li>Multiple statements can be separated with semicolon.";
echo "<li>The value of \$r will be displayed.";
echo "<form name=f method=GET action=$PHP_SELF>";
if (isset($pw)) echo "<input name=pw type=hidden value='$pw'>";
else echo "Password <input name=pw size=10> &nbsp; <input type=submit><br>";
if (!isset($expr)) $expr='$r = $GLOBALS';
echo "<input name=expr size=60 value='".stripslashes($expr)."'>";
echo "</form><font face='lucida console' size=+1>";

if (isset($pw) and $pw=="BULLDOG" and isset($expr))
{
   $r = "not set";
   $ex = stripslashes($expr).";";
   echo "eval('<b> $ex </b>')<p>";
   eval($ex);
   if (gettype($r)=='array') {
     echo "\$r is an array... ";
     foreach ($r as $k => $i) echo "<br>$k = $i";
   } else echo "\$r is $r ";
}

?>
--------------- cut here ----------------


John Henckel          alt. mailto:[EMAIL PROTECTED]
Zumbro Falls, Minnesota, USA   (507) 753-2216

http://geocities.com/jdhenckel/


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to