|
|
|
original http://www.weberdev.com/get_example-3096.html by Erwin Poelman
Attached file is a modification of original code by Erwin Poelman from 2001.
I have updated it and made some minor improvements.
| <?php
/* Original code by Erwin Poelman found on
http://www.weberdev.com/get_example-3096.html
This is a little more up to date and formatted for readability.
Some things in PHP have changed since Erwin Poelman first posted this
and a couple of things had to be added to resolve variables that are
no longer automagically (yes, I spelled it right!;) set. Also added
a test for <?...?> enclosure. Changed the hard coded file name (originally
'generate.php') in the src attributes to server resolution through the
'PHP_SELF' value.
Otherwise, its a pretty neat and tidy little browser PHP interpretter, just
as Erwin Poelman originally wrote it!;)
*/
if(isset($_REQUEST['dispArea']))$dispArea=$_REQUEST['dispArea'];
if(isset($_REQUEST['theCode']))$theCode=$_REQUEST['theCode'];
if(!isset($dispArea))
{
echo "<frameset cols='60%,40%'>\r\n";
echo "<frame name='theCode' src='".$_SERVER['PHP_SELF']."?dispArea=left'>\r\n";
echo "<frame name='theExec' src='".$_SERVER['PHP_SELF']."?dispArea=right'>\r\n";
echo "</frameset>\r\n";
}
else
{
if(!strcmp($dispArea,"left"))
{
echo "<body bgcolor='#D0DEED'>\r\n";
echo "<font face='Arial,Verdana,Helvetica' color='FF0000' size='3'>PHP Tester</font>\r\n";
echo "<form method='post' action='".$_SERVER['PHP_SELF']."?dispArea=right' target='theExec'>\r\n";
echo "<table>\r\n";
echo "<tr><td align='center'>\r\n";
echo "<input type='submit' value='Execute'>\r\n";
echo "</td></tr>\r\n";
echo "<tr><td>\r\n";
echo "<textarea name='theCode' cols='65' rows='25' wrap='virtual'>\r\n";
echo $theCode."\r\n";
echo "</textarea>\r\n";
echo "</td></tr>\r\n";
echo "</table>\r\n";
echo "</form>\r\n";
}
else if(!strcmp($dispArea,"right"))
{
echo "<body bgcolor='#FFFFFF'>\r\n";
if(empty($theCode))
{
echo "Ready to parse...";
}
else
{
$theCode=ltrim(rtrim(stripSlashes($theCode)));
if(!strncmp($theCode,"<?",2)) //if it's full php, remove the tags
{
if(!strncmp($theCode,"<?php",5))
{
$theCode=substr($theCode,5);
}
else
{
$theCode=substr($theCode,2);
}
$theCode=substr($theCode,0,strlen($theCode)-2);
$theCode=ltrim(rtrim(stripSlashes($theCode)));
}
eval($theCode);
}
}
echo "</body>";
}
?> | | |
|
| PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use! Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP | | | a function that builds an HTML select list from any mysql table. Categories : PHP, MySQL, HTML and PHP | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | Alternating background color for HTML table rows Categories : PHP, Databases, MySQL, HTML and PHP | | | Constantly refresh your PHP/HTML page data. Categories : PHP, HTML and PHP, Sybase | | | background music script for random notes in a frame Categories : PHP, Content Management, HTML and PHP | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | | | Random Image Display Categories : PHP, Filesystem, Graphics, HTML and PHP | | | PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | | | PHP template processing Categories : PHP, Templates, HTML and PHP | | | XDT Topsite (Gold v1.0) Categories : Databases, CSS, PHP, HTML and PHP, Sessions | | | function textwrap will wrap text to any desired width using <BR>\n as the default line break.
Default wrap width is 80 columns.
Categories : Strings, HTML and PHP, PHP | | | Using select multiple with php3 Categories : HTML and PHP, PHP | |
| | | | Abdoulaye Siby wrote :1377
Very neat!
| |
|
|
|