Code Snippet </> Info
Snippet Name: PHP Tester 3
Description: Lets you test PHP code directly through your browser.
Note: You will need to create a file called script.inc
Upload to your server. CHMOD to 0666 or 0777
Author: Eric
Last Modified: 2019-12-15 01:40:31
Language: php
Highlight Mode: html
|
Copy Codes: Use Free Notepad ++ |
|
Snap HTML Code Editor: Paste the source code, make changes and instantly see it in live preview. Snap HTML Code Editor
|
|
Copied To Clipboard!
<form action=<?php echo $_SERVER['PHP_SELF']; ?> method="post">
PHP Tester 3 (please do not include <? or ?>)
<br /><br />
<textarea name="test_script" id="snapbuilder" rows="15" cols="75"></textarea>
<br />
<input type="submit" name="submit" value="Begin Testing Script">
</form>
<?php
/*
Setup in 4 easy steps
1. Create a blank file named: script.inc
2. Upload the script.inc file to your server.
3. CHMOD the script.inc file to 0666 or 0777, whichever works for you, so that this script can write to it.
4. Change $path to where you uploaded script.inc, for example:
Say you uploaded to http://www.yourdomain.com/your-folder-name/script.inc
The path would be: http://www.yourdomain.com/your-folder-name/
Script found at: https://sanpbuilder.com Public Codes Library
*/
if(!empty($_POST['test_script']))
{
$script_to_test = $_POST['test_script'];
$path = "http://www.yourdomain.com/somefolder/";
if($script_to_test)
{
$file = "script.inc";
if(file_exists($file))
{
$fp = fopen("$file", "w");
fwrite($fp, "<?phpn");
fwrite($fp, $script_to_test);
fwrite($fp, "?>n");
fclose($fp);
include($path."script.inc");
exit();
}
}
}
?>
|