Mega Code Archive

 
Categories / Php / HTML
 

PHP Tester - Lets you test php code from a browser

<? // This code creates two frames. The lest frame is a textarea that you can write // PHP code in and execute it. On the right frame you will see the result of the // code that was executed. // If you intend to check this make sure you call your file : generate.php or // change it's name in the code /* -BEGIN PHP TESTER */ function generateFrames() { echo "<FRAMESET COLS=\"660,*\">\n"; echo "<FRAME NAME=\"input\" SRC=\"generate.php?page=left\">\n"; echo "<FRAME NAME=\"output\" SRC=\"generate.php?page=right\">\n"; echo "</FRAMESET>"; } if($page=="left") { echo "<BODY BGCOLOR=\"#FFFFFF\">"; echo "<FONT FACE=\"Arial,Verdana,Helvetica\" COLOR=\"FF0000\" SIZE=\"3\">PHP Tester</FONT>"; echo "<FORM METHOD=\"post\" ACTION=\"generate.php?page=right\" TARGET=\"output\">\n"; echo "<TABLE BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">\n"; echo "<TR><TD><TEXTAREA NAME=\"input\" COLS=\"100\" ROWS=\"40\" WRAP=\"virtual\">".$input."</TEXTAREA></TD></TR>\n"; echo "<TR><TD ALIGN=\"center\"><INPUT TYPE=\"submit\" VALUE=\"Execute\"></TD></TR></TABLE></FORM>\n"; echo "</BODY>"; } else if ($page=="right") { echo "<BODY BGCOLOR=\"#FFFFFF\">"; if(empty($input)) { echo "Ready to parse..."; } else { $input=stripSlashes($input); eval($input); } echo "</BODY>"; } else { generateFrames(); } /* END PHP TESTER */ ?>