Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 05:49:47 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155545 Posts in 21714 Topics by 7736 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Calling PHP code in droplet and security?  (Read 569 times)
MarkPrima

Offline Offline

Posts: 20


« on: May 13, 2011, 08:43:10 PM »

Hi everyone,

I have read about security using the include call in a droplet.
But I was wondering if this can be a droplet " <?php include("includes/file.php"); ?>

Ultimately, I would like to use this to include a contact form.

Thanks
Logged

pcwacht
AddOn Development
*
Offline Offline

Posts: 2858



WWW
« Reply #1 on: May 19, 2011, 06:21:06 PM »

sorry missed this post, ah well, better late then never Wink

To only include a file as a droplet seems a bit weird, maybe better
to open the file, copy the contents to a droplet, remove the <?php ?> php tags
check for echo's since a dorplet can't echo

Maybe better to copy the content into a code section?

If yo uneed to include a file make sure paths are correct!
Sometimes a matter of trial and error.

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
NorHei
Forum administrator
*****
Offline Offline

Posts: 485



WWW
« Reply #2 on: May 19, 2011, 07:16:41 PM »

If the include is specially build for use in a droplet this is posible, otherwise you have to use this:
Code:
ob_start();
include("includes/file.php");
$output=ob_get_contents();
ob_end_clean();
return $output ;
A droplet expects you to return a value just like a function does.
Logged

It is easier to change the specification to fit the program than vice versa.
pcwacht
AddOn Development
*
Offline Offline

Posts: 2858



WWW
« Reply #3 on: May 19, 2011, 08:55:51 PM »

ps, that security issue you referring to is:
in wb3 changes are commands like eval and include will be forbidden in droplets and code

In wb2.8 (current stable) it is still allowed as are all php commands.
Droplets don't echo output direct, they return output instead.

There are some debates about wanting this 'feature'


John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
NorHei
Forum administrator
*****
Offline Offline

Posts: 485



WWW
« Reply #4 on: May 19, 2011, 09:26:04 PM »

As Droplets is a Modul you can still install a version whithout that problem .
Logged

It is easier to change the specification to fit the program than vice versa.
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!