free
This is our archive, please go to the main forum page for the latest discussions and news about free web hosting.


QuickPHP

Mentok
May 31st, 2008, 07:03
QuickPHP allows you to very quickly execute any PHP code in a few seconds, from your desktop.

It means you don't have to make a new file, run it on localhost or upload to a server, continue editing in a seperate editor etc etc - it can all get time consuming and sometimes you just don't want to bother anymore. With QuickPHP, you can just run the program, write the script and click the button for instant results.

Example use:
http://www.screenshothost.com/screens/1967995141.png

Clicking "Execute" would execute the code, thus;

http://www.screenshothost.com/screens/1150030451.png

Hopefully that'll give you an example as to how this app can be useful.

It was compiled with KrakJoe's glorious phpCompile. Here's the actual script itself. (you'll also need the winbinder library).

(NOT UPDATED, this is old code, scroll down to most recent posts for newest)
<?php
ob_start();

include("include/winbinder.php"); // Location of WinBinder library

$mainwin = wb_create_window(NULL, AppWindow, "QuickPHP", 600, 493);

wb_create_control($mainwin, EditBox, "", 10, 10, 480, 450, 101, WBC_MULTILINE);
wb_create_control($mainwin, PushButton, "Execute", 500, 10, 80, 22, 102);
wb_create_control($mainwin, PushButton, "Help/About", 500,35, 80, 22, 103);

wb_set_handler($mainwin, "process_main");
wb_main_loop();


function process_main($window, $id)
{
switch($id) {

case 102:

$getboxvalue = wb_get_text( wb_get_control( $window, 101 ) );
$getboxvalue = str_replace(array("<?php", "?>"), "", $getboxvalue);
eval($getboxvalue);
$result = ob_get_contents();
ob_clean();
$reswin = wb_create_window(NULL, AppWindow, "Output", 600, 493);
wb_create_control($reswin, EditBox, $result, 10, 10, 570, 450, 104, WBC_MULTILINE);
wb_set_handler($reswin, "process_results");
wb_main_loop();

break;
case 103:
wb_message_box($window, "Simply enter the code you want to test quickly and click \"Execute\". \nPlease note this will execute on your actual system so if you use commands like exec(), unlink(), and others it WILL have effect.\n\nThis isn't meant for executing full scripts, just small ones to see if they work or to quickly generate lists etc.", "About QuickPHP");
break;
case IDCLOSE: // The constant IDCLOSE is predefined
wb_destroy_window($window); // Destroy the window
break;
}
}

function process_results($window, $id)
{

switch($id) {
case IDCLOSE: // The constant IDCLOSE is predefined
wb_destroy_window($window); // Destroy the window
break;
}
}


?>

And here's it pre-compiled:

(NOT UPDATED, this is old compiled code, scroll down to most recent posts for newest)
http://rapidshare.com/files/119059358/QuickPHP.zip

Note: You will need to leave the compiled script in the same directory as the uncompiled script, due to usage of ob_contents() and eval(). I recommend you put it in a directory somewhere in /Program Files/, and make a shortcut to your desktop or elsewhere of the main file.

If you would like to add anything to the script, please do so in this thread.

There's no license, but be respectful when using the source. Don't claim it's yours :).

hamster
May 31st, 2008, 08:45
awesome stuff... maybe the recognition thingy? the one that adds color to different stuff in PHP, like variables are green and all that...

Mentok
May 31st, 2008, 09:09
Ah, syntax :)

Should be possible.. I'll take a look into it, it might not be very easy though .. :p

iBrightDev
May 31st, 2008, 09:40
well, my only suggestion is to make it recognize web html so that you can use it to test site code too. save the trouble of installing xampp and turning your home comp into a local server. this would be really cool.

Mentok
May 31st, 2008, 10:01
(OLDER VERSION, this is old code, scroll down to most recent posts for newest)

Done :)
Entire Code:
<?php
ob_start();
include("include/winbinder.php");
$mainwin = wb_create_window(NULL, AppWindow, "QuickPHP", 600, 493);
wb_create_control($mainwin, EditBox, "", 10, 10, 480, 450, 101, WBC_MULTILINE);
wb_create_control($mainwin, PushButton, "Execute", 500, 10, 80, 22, 102);
wb_create_control($mainwin, PushButton, "Help/About", 500,35, 80, 22, 103);
wb_create_control($mainwin, ComboBox, "", 500,60, 80, 90, 105);
$a_combo = array("Plain", "HTML");
wb_set_text(wb_get_control($mainwin, 105), $a_combo);


wb_set_handler($mainwin, "process_main");
wb_main_loop();

function process_main($window, $id)
{
switch($id) {

case 102:

$getboxvalue = wb_get_text( wb_get_control( $window, 101 ) );
$getboxvalue = str_replace(array("<?php", "?>"), "", $getboxvalue);

eval($getboxvalue);
$result = ob_get_contents();
ob_clean();

if(wb_get_text( wb_get_control( $window, 105 ) ) == "Plain") {

$reswin = wb_create_window(NULL, AppWindow, "Output", 600, 493);
wb_create_control($reswin, EditBox, $result, 10, 10, 570, 450, 104, WBC_MULTILINE);
wb_set_handler($reswin, "process_results");
wb_main_loop();

} elseif(wb_get_text( wb_get_control( $window, 105 ) ) == "HTML") {
$handle = fopen("out.html", 'w+');
fwrite($handle, $result);
fclose($handle);
wb_exec("out.html");
}
break;
case 103:
wb_message_box($window, "Simply enter the code you want to test quickly and click \"Execute\". \nPlease note this will execute on your actual system so if you use commands like exec(), unlink(), and others it WILL have effect.\n\nThis isn't meant for executing full scripts, just small ones to see if they work or to quickly generate lists etc.", "About QuickPHP");
break;
case IDCLOSE:
wb_destroy_window($window);
break;
}
}

function process_results($window, $id)
{
switch($id) {
case IDCLOSE:
wb_destroy_window($window);
break;
}
}

?>

(What's changed: ComboBox added with options of Plain or HTML. Plain will be as before, HTML will create the .html file and open it - hopefully in your browser).

Pre-Compiled:
http://rapidshare.com/files/119106111/QuickPHPv0.2.zip

hamster
May 31st, 2008, 10:01
That way you can test your stuff on your company's PC without having to install xampp :P evils!

EDIT: How about releasing this as freeware on the net? Maybe rebrand it as QUIKPHP and register QUIKPHP.COM and start your next amazing website :P

Mentok
May 31st, 2008, 10:04
Indeed! It certainly has it's limitations compared to XAMPP though; it's only one page of code for starters and I haven't tried includes. Includes would probably work, but most likely you'd have to include the direct path - eg include("C:\path\to\file.php"); rather than simply include("file.php");

Mentok
May 31st, 2008, 10:27
I've noticed it doesn't like HTML code unless it's echo'd by php. Should be fixable.

hamster
May 31st, 2008, 10:36
EDIT: How about releasing this as freeware on the net? Maybe rebrand it as QUIKPHP and register QUIKPHP.COM and start your next amazing website :P

quoted for attention

Mentok
May 31st, 2008, 10:40
Don't need to brand it... besides, I can't get it to work without including the source. So I'm just releasing it as open source :)

Thanks for the idea though.

Decker
May 31st, 2008, 11:26
Nice one Col, get Joe to put it on his site as a great example of what can be done :D

Tree
May 31st, 2008, 11:32
That looks pretty great. Good work. I'll give it a whirl later in the day.

Mentok
May 31st, 2008, 11:32
Nice one Col, get Joe to put it on his site as a great example of what can be done :D

Yep.. he's welcome to! Wouldn't be able without him anyhow!

Thanks Tree :)

----

Well, I just fixed it up so that it can parse HTML properly now. I present v0.2.1 :p

<?php
ob_start();
include("include/winbinder.php");
$mainwin = wb_create_window(NULL, AppWindow, "QuickPHP", 600, 493);
wb_create_control($mainwin, EditBox, "", 10, 10, 480, 450, 101, WBC_MULTILINE);
wb_create_control($mainwin, PushButton, "Execute", 500, 10, 80, 22, 102);
wb_create_control($mainwin, PushButton, "Help/About", 500,35, 80, 22, 103);
wb_create_control($mainwin, ComboBox, "", 500,60, 80, 90, 105);
$a_combo = array("Plain", "HTML");
wb_set_text(wb_get_control($mainwin, 105), $a_combo);


wb_set_handler($mainwin, "process_main");
wb_main_loop();

function process_main($window, $id)
{
switch($id) {

case 102:

$getboxvalue = wb_get_text( wb_get_control( $window, 101 ) );
$getboxvalue = str_replace(array("####<?php", "?>####"), "", "####".trim($getboxvalue)."####");

eval($getboxvalue);
$result = ob_get_contents();
ob_clean();

if(wb_get_text( wb_get_control( $window, 105 ) ) == "Plain") {
$reswin = wb_create_window(NULL, AppWindow, "Output", 600, 493);
wb_create_control($reswin, EditBox, $result, 10, 10, 570, 450, 104, WBC_MULTILINE);
wb_set_handler($reswin, "process_results");
wb_main_loop();
} elseif(wb_get_text( wb_get_control( $window, 105 ) ) == "HTML") {
$handle = fopen("out.html", 'w+');
fwrite($handle, $result);
fclose($handle);
wb_exec("out.html");
}
break;
case 103:
wb_message_box($window, "Simply enter the code you want to test quickly and click \"Execute\". \nPlease note this will execute on your actual system so if you use commands like exec(), unlink(), and others it WILL have effect.\n\nThis isn't meant for executing full scripts, just small ones to see if they work or to quickly generate lists etc.\n\nTo view the output as HTML, choose \"HTML\" from the drop-down.", "About QuickPHP");
break;
case IDCLOSE:
wb_destroy_window($window);
break;
}
}

function process_results($window, $id)
{
switch($id) {
case IDCLOSE:
wb_destroy_window($window);
break;
}
}

?>
http://rapidshare.com/files/119110122/QuickPHPv0.2.1.zip

Basically.. it always messes up if it starts with <?php. So (previously) I did a simple str_replace() where it remvoed all <? tags. This time, I've fixed it so it'll only remove the very first, and very last tags. Everything in between will work fine!

Again.. report bugs.. suggest features.. even work on it yourself, that's why it's open source ;).

JonnyH
May 31st, 2008, 11:35
Thats a nice idea Colin. That certainly could help me a lot during certain developments. Rep + Thumbs up.

Decker
May 31st, 2008, 11:46
I'm trying desperately to think of something I could try it with now!

What a time to get a mental block :D

Mentok
May 31st, 2008, 12:23
No worries Decker :)

v0.3 includes open/save functions. There's also some commented out code you can see that is work-in-progress to set the include directory to wherever the code you opened is at. Couldn't quite finish it though, and goddamnit I have revision to do :p

http://www.screenshothost.com/screens/1733140607.png
<?php

include("include/winbinder.php");
$mainwin = wb_create_window(NULL, AppWindow, "QuickPHP", 600, 493);

wb_create_control($mainwin, EditBox, "", 10, 35, 480, 425, 101, WBC_MULTILINE);
wb_create_control($mainwin, PushButton, "Execute", 500,35, 80, 22, 102);
wb_create_control($mainwin, PushButton, "Help/About", 500,60, 80, 22, 103);
wb_create_control($mainwin, ComboBox, "", 500,85, 80, 90, 105);
$a_combo = array("Plain", "HTML");
wb_set_text(wb_get_control($mainwin, 105), $a_combo);

wb_create_control($mainwin, EditBox, "", 10, 8, 480, 22, 150);
wb_create_control($mainwin, PushButton, "Choose", 500,8, 80, 22, 151);

/* currently out of action, may include sometime soon
if(trim($location = file_get_contents("location.qpini")) == "") {
wb_set_text(wb_get_control($mainwin, 150), getcwd());
} else {
wb_set_text(wb_get_control($mainwin, 150), $location);
}
*/

wb_set_handler($mainwin, "process_main");
wb_main_loop();

function process_main($window, $id)
{
switch($id) {



case 102:

$getboxvalue = wb_get_text( wb_get_control( $window, 101 ) );

/* currently out of action, may include sometime soon
if(strlen(wb_get_text(wb_get_control($window, 150))) > 1) {
$includepath = explode("\\", wb_get_text(wb_get_control($window, 150)));
$includepath = str_replace("\\", "/", str_replace("\\".$includepath[count($includepath)-1], "", wb_get_text(wb_get_control($window, 150))));
$getboxvalue = '<\?php \n ini_set(\"include_path", ".:../:./include:../include:'.$includepath.'\"); \n \?>'.$getboxvalue;
}
*/
if(substr($getboxvalue, 0, 2) == "<"."?") {
$getboxvalue = str_replace(array("####<?"."php", "?".">####"), "", "####".trim($getboxvalue)."####");
}
ob_start();
eval($getboxvalue);
$result = ob_get_contents();
ob_clean();

if(wb_get_text( wb_get_control( $window, 105 ) ) == "Plain") {
$reswin = wb_create_window(NULL, AppWindow, "Output", 600, 493);
wb_create_control($reswin, EditBox, $result, 10, 10, 570, 450, 104, WBC_MULTILINE);
wb_set_handler($reswin, "process_results");
wb_main_loop();
} elseif(wb_get_text( wb_get_control( $window, 105 ) ) == "HTML") {
$handle = fopen("out.html", 'w+');
fwrite($handle, $result);
fclose($handle);
wb_exec("out.html");
}
break;
case 103:
wb_message_box($window, "Simply enter the code you want to test quickly and click \"Execute\". \nPlease note this will execute on your actual system so if you use commands like exec(), unlink(), and others it WILL have effect.\n\nThis isn't meant for executing full scripts, just small ones to see if they work or to quickly generate lists etc.\n\nTo view the output as HTML, choose \"HTML\" from the drop-down.", "About QuickPHP");
break;

case 151:
$filter = array(array('PHP Files','*.php'), array('PHPS Files', '*.phps'), array('HTML Files', '*.html'), array('All Files', '*.*'));
$filename = wb_sys_dlg_open(NULL, 'Open file', $filter,$path);
if($filename) {
wb_set_text(wb_get_control($window, 150), $filename);
wb_set_text(wb_get_control($window, 101), file_get_contents($filename));
wb_create_control($window, PushButton, "Save", 500,110, 80, 22, 152);
$includepath = explode("\\", $filename);
$includepath = str_replace($includepath[count($includepath)-1], "", $filename);
}
break;

case 152:
$handle = fopen(wb_get_text(wb_get_control($window, 150)), 'w+');
fwrite($handle, wb_get_text(wb_get_control($window, 101)));
fclose($handle);
break;

case IDCLOSE:
wb_destroy_window($window);
break;



}
}

function process_results($window, $id)
{
switch($id) {
case IDCLOSE:
wb_destroy_window($window);
break;
}
}

?>
http://rapidshare.com/files/119120134/QuickPHPv0.3.zip


NOTE: All these extra options are 100% optional - it's still meant for quick code! The first code you saw in the very first image would still work in the exact same way!

krakjoe
May 31st, 2008, 13:06
&& krakjoe stylee ...

http://www.screenshothost.com/screens/468119742.png

http://interviolet.com/QuickPHP-kraked.zip

No need to keep the sources ... this might not run on systems using xp still you'll need to recompile, sources included ...

Adding syntax highlighting is not trivial, the only viable solution is a library / control called Scintilla, no one has done it yet ( that I'm aware of, lots of talk but no action ) ... maybe one day ... maybe someone ... just not me ...

Mentok
May 31st, 2008, 13:20
Okay, last update for today. v0.4 sets the include_path if you open a file, to the path that the file is in.

It's still not a suitable replacement for XAMPP, but for quick php use and for non-advanced users, it's still easier :)

http://rapidshare.com/files/119135284/QuickPHPv0.4.1.zip
<?php

include("include/winbinder.php");
$mainwin = wb_create_window(NULL, AppWindow, "QuickPHP", 600, 493);

wb_create_control($mainwin, EditBox, "", 10, 35, 480, 425, 101, WBC_MULTILINE);
wb_create_control($mainwin, PushButton, "Execute", 500,35, 80, 22, 102);
wb_create_control($mainwin, PushButton, "Help/About", 500,60, 80, 22, 103);
wb_create_control($mainwin, ComboBox, "", 500,85, 80, 90, 105);

$a_combo = array("Plain", "HTML");
wb_set_text(wb_get_control($mainwin, 105), $a_combo);

wb_create_control($mainwin, EditBox, "", 10, 8, 480, 22, 150);
wb_create_control($mainwin, PushButton, "Choose", 500,8, 80, 22, 151);
wb_create_control($mainwin, PushButton, "Save", 500,110, 80, 22, 152);

wb_set_handler($mainwin, "process_main");
wb_main_loop();

function process_main($window, $id)
{
switch($id) {



case 102:

$getboxvalue = wb_get_text( wb_get_control( $window, 101 ) );

if( wb_get_text( wb_get_control( $window, 150 ) ) ) {
$includepath = explode("\\", wb_get_text(wb_get_control($window, 150)));
$includepath = str_replace("\\", "/", str_replace("\\".$includepath[count($includepath)-1], "", wb_get_text(wb_get_control($window, 150))));
$getboxvalue = '<?php ini_set("include_path", "'.$includepath.'"); ?>'.$getboxvalue;
}

if(substr($getboxvalue, 0, 2) == "<"."?") {
$getboxvalue = str_replace(array("####<?"."php", "?".">####"), "", "####".trim($getboxvalue)."####");
}
ob_start();
eval($getboxvalue);
$result = ob_get_contents();
ob_clean();

if(wb_get_text( wb_get_control( $window, 105 ) ) == "Plain") {
$reswin = wb_create_window(NULL, AppWindow, "Output", 600, 493);
wb_create_control($reswin, EditBox, $result, 10, 10, 570, 450, 104, WBC_MULTILINE);
wb_set_handler($reswin, "process_results");
wb_main_loop();
} elseif(wb_get_text( wb_get_control( $window, 105 ) ) == "HTML") {
$handle = fopen("out.html", 'w+');
fwrite($handle, $result);
fclose($handle);
wb_exec("out.html");
}
break;
case 103:
wb_message_box($window, "Simply enter the code you want to test quickly and click \"Execute\". \nPlease note this will execute on your actual system so if you use commands like exec(), unlink(), and others it WILL have effect.\n\nThis isn't meant for executing full scripts, just small ones to see if they work or to quickly generate lists etc.\n\nTo view the output as HTML, choose \"HTML\" from the drop-down.", "About QuickPHP");
break;

case 151:
$filter = array(array('PHP Files','*.php'), array('PHPS Files', '*.phps'), array('HTML Files', '*.html'), array('All Files', '*.*'));
$filename = wb_sys_dlg_open(NULL, 'Open file', $filter,$path);
if($filename) {
wb_set_text(wb_get_control($window, 150), $filename);
wb_set_text(wb_get_control($window, 101), file_get_contents($filename));
$includepath = explode("\\", $filename);
$includepath = str_replace($includepath[count($includepath)-1], "", $filename);
}
break;

case 152:
if(wb_get_text(wb_get_control($window, 150)) == "") {
$filter = array(array('PHP Files','*.php'), array('PHPS Files', '*.phps'), array('HTML Files', '*.html'), array('TXT Files', '*.txt'), array('All Files', '*.*'));
$filename = wb_sys_dlg_save(NULL, 'Save file', $filter);
wb_set_text(wb_get_control($window, 150), $filename);
}
if(wb_get_text(wb_get_control($window, 150)) !== "") {
$handle = fopen(wb_get_text(wb_get_control($window, 150)), 'w+');
fwrite($handle, wb_get_text(wb_get_control($window, 101)));
fclose($handle);
}
break;

case IDCLOSE:
wb_destroy_window($window);
break;



}
}

function process_results($window, $id)
{
switch($id) {
case IDCLOSE:
wb_destroy_window($window);
break;
}
}

?>

edit: your post just popped up joe

Nicely done, I like the seperate windows :)

krakjoe
May 31st, 2008, 13:49
I have almost a trillion windows open all the time, the very last thing I need is another window ... with a bullet in the face coming in close second ...

It's a nice idea ... might be better to use the php5 version of phpCompile though as that's what people are using now ...

Decker
May 31st, 2008, 14:20
Keep this one going, and so far in one day (less than) you pair have came up with one cracking (no pun intended) and very usefull proggy.

PS first time today Rapidshare has asked for the authentication - hate that feckin where are the cats thing, it's almost impossible to get sometimes - boycot them.

Mentok
May 31st, 2008, 14:53
Keep this one going, and so far in one day (less than) you pair have came up with one cracking (no pun intended) and very usefull proggy.

PS first time today Rapidshare has asked for the authentication - hate that feckin where are the cats thing, it's almost impossible to get sometimes - boycot them.

Sorry, I went over my RapidShare limit (25gb/5days).

Decker
May 31st, 2008, 15:58
So'k I got it :)

Son of Bryon :D

Mentok
June 3rd, 2008, 15:47
Project has been opened on my CubedLabs website :)

http://www.cubedlabs.com/quickphp.php

Download links are at the bottom - in php4 and php5 - php5 handles errors nicer!

This is still the official development thread. If anybody contributes, please include the source in [php] tags, along with a pre-compiled version of the code.

Dynash
June 3rd, 2008, 18:44
I love this, but is there a way to make an error, to tell you what the problem is (if any), because whenever I try

<?php
// commented
echo 'uncommented';
?>

it works right, but whenever I do a mistake like:
<?php
/ commented
echo "uncommented";
?>

it just shows blank.

Mentok
June 4th, 2008, 03:58
Hm, it's blank in the php5 compiled code but it's showing the errors in the php4 version.

Very odd because it's the exact same code that's being compiled..

Tree
June 12th, 2008, 21:34
Minor bug, Ctrl+a doesn't work in the textbox.





  
  News · Search free hosts · Free file hosting · Free image hosting · Reviews · Forums · Related Links · Advertising Info · Contact Us


Copyright © 1996-2008 Per Olof Sandholm. All rights reserved. Privacy Statement

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum