MyBB Community Forums

Full Version: Running PHP Code in Script (Post)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi. I use DLGuard for extra protection with downloads (PDF files). I have no problem adding their php codes for download in my main website, but when I add them to the forum posts I get a new window with an ERROR 404 as if the page does not exist. I contacted DLGuard about this, and they said that I need to come to mybb to find out how to run PHP code inside the script (posts). Can someone help me with this?

For instance, a code I place may be as the following:

<a href="<?php echo $downloadProduct[28]; ?>">Download Product 28</a>

I will get a link that says "Download Product 28." However, after clicking on it, I am taken to the new window with an ERROR 404.

The link location is as follows:

Quote:http://www.911bodyrescue.com/locker/%3C?php%20echo%20$downloadProduct[28];%20?%3E

From what I understand from DLGuard, this is still in HTML format and had not been converted in PHP. I hope this makes sense.
This will require either some changes to core files or a plugin. There is no parsing of PHP inside of posts at this time. This the opening and closing PHP tags (<?php and ?>) are ignored and just treated as part of the URL.

Also, you would need to include the DLGuard files in some manner to get $downloadProduct[] variable set.

I have no direct experience with DLGuard, so I can't offer anymore information at this point.
Thanks for your response. Do you know what type of plugin I may need and where I may be able to obtain it?

(2010-09-10, 05:09 PM)Dylan M. Wrote: [ -> ]This will require either some changes to core files or a plugin. There is no parsing of PHP inside of posts at this time. This the opening and closing PHP tags (<?php and ?>) are ignored and just treated as part of the URL.

Also, you would need to include the DLGuard files in some manner to get $downloadProduct[] variable set.

I have no direct experience with DLGuard, so I can't offer anymore information at this point.

You would likely have to hire someone to write one. They would need a working knowledge of DLGuard and/or access to your files (ftp access or a copy of your DLGuard files) to work from. Mainly the instructions on how to integrate into a website. I poked around the DLGuard forums a bit, but they only talked about phpBB for forum integration, and I didn't see any actual results of that posted anywhere. It sounds like it should be fairly simple, so I don't think it would take long to write it either.
does DLGaurd have you insert any javascript or PHP into the templates or files? how is MyBB supposed to know what $downloadProduct[28] is?
Thank you! Heart

(2010-09-10, 06:23 PM)Dylan M. Wrote: [ -> ]You would likely have to hire someone to write one. They would need a working knowledge of DLGuard and/or access to your files (ftp access or a copy of your DLGuard files) to work from. Mainly the instructions on how to integrate into a website. I poked around the DLGuard forums a bit, but they only talked about phpBB for forum integration, and I didn't see any actual results of that posted anywhere. It sounds like it should be fairly simple, so I don't think it would take long to write it either.


As I stated in my original post, this is the PHP code to insert to the page:

<a href="<?php echo $downloadProduct[28]; ?>">Download Product 28</a>

Other than that, I have no clue what you mean. I'm not as techie as some of you guys to understand as much. But, I appreciate your help. Smile

(2010-09-10, 06:35 PM)pavemen Wrote: [ -> ]does DLGaurd have you insert any javascript or PHP into the templates or files? how is MyBB supposed to know what $downloadProduct[28] is?

He means where is the $downloadProduct array set?? Even if a plugin was written to parse this, it's got to get the value of $downloadProduct from somewhere hasn't it. Where would this be set??