• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

QuickPHP

themoose

Sup, Recoil here.
NLC
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:
1967995141.png


Clicking "Execute" would execute the code, thus;

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:
<?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 :).
 
Last edited:
awesome stuff... maybe the recognition thingy? the one that adds color to different stuff in PHP, like variables are green and all that...
 
Ah, syntax :)

Should be possible.. I'll take a look into it, it might not be very easy though .. :p
 
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.
 
(OLDER VERSION, this is old code, scroll down to most recent posts for newest)

Done :)
Entire Code:
PHP:
<?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
 
Last edited:
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
 
Last edited:
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");
 
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.
 
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:
<?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 ;).
 
Last edited:
Thats a nice idea Colin. That certainly could help me a lot during certain developments. Rep + Thumbs up.
 
I'm trying desperately to think of something I could try it with now!

What a time to get a mental block :D
 
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

1733140607.png

PHP:
<?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 stylee ...

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 ...
 
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:
<?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 :)
 
Last edited:
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 ...
 
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.
 
Back
Top