Cannot execute external php file

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
st3fek
Posts: 17
Joined: Thu 4. Aug 2005, 11:17
Location: Poland, Sosnowiec
Contact:

Cannot execute external php file

Post by st3fek »

Hi!

I'm using latest version of phpwcms, but I have a little problem with {PHP:my_external_file.php} tag.

I have simple code (which found on this forum) - it get the top category ID. I need this to put this ID into flash file, which is located in header.

Code: Select all

$check_id = $GLOBALS['content']['cat_id'];
$struct_id = $GLOBALS['content']['struct'][$check_id]['acat_struct'];
$nav_id = $check_id;

while ($struct_id != 0) {
$nav_id = $struct_id;
$struct_id = $GLOBALS['content']['struct'][$struct_id]['acat_struct'];
}

$Number = $GLOBALS['color']['randnr'];

echo '
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="750" height="150" id="p_info'.$Number.'" align="">
<param name="movie" value="img/swf/p_info'.$Number.'.swf?p='.$nav_id.'"><param name="menu" value="false"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="bgcolor" value="#FFFFFF">

<embed src="img/swf/p_info'.$Number.'.swf?p='.$nav_id.'" menu="false" quality="high" wmode="transparent" bgcolor="#FFFFFF" width="750" height="150" name="p_info'.$Number.'" align="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>

</object>
';
On my local mashine it works fine, but after uploading everything on server it gives me a warning:

Code: Select all

Warning: strpos(): Empty delimiter. in /include/inc_front/front.func.inc.php on line 1642
When I put this code directly in [PHP] // code frome above [/PHP], there isn't any problem. However, this isn't good solution for me.

Do you have any ideas how to fix this? [/code]
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post by pepe »

Don't forget, to put your code into the following delimiters!

<?PHP
.
.
.

?>
st3fek
Posts: 17
Joined: Thu 4. Aug 2005, 11:17
Location: Poland, Sosnowiec
Contact:

Post by st3fek »

Thx, but I'm not begginer in PHP. ;)
That's not it. :(
Somehow, {PHP:my_external_file.php} can't see variable "my_external_file.php", even than file exists.
I don't have any idea what can be wrong.
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post by pepe »

I always put my php.scripts into the special directory ......./scripts
and use then:

{PHP:scripts/my_external_file.php}

so the call "finds" the scripts :lol: and works:::
st3fek
Posts: 17
Joined: Thu 4. Aug 2005, 11:17
Location: Poland, Sosnowiec
Contact:

Post by st3fek »

Ok, I have my scripts in subfolder too, but it still don't working.
{PHP:...} tag:

{PHP:phpwcms_template/inc_pinfo/GetRandomFlash.php}
Pappnase

Post by Pappnase »

hallo

schau mal in die conf.inc.php
[quote=http://www.phpwcms-docu.de/index.php?conf.inc.php_de]
$phpwcms["allow_remote_URL"] = 0; Wenn Sie im {PHP:...} Tag URL aufrufen wollen müssen Sie diesen Wert auf 1 setzten. Wert: 0 = URL erlaubt (standard) / 1 = URL verboten[/quote]
st3fek
Posts: 17
Joined: Thu 4. Aug 2005, 11:17
Location: Poland, Sosnowiec
Contact:

Post by st3fek »

Pappnase, can you please write your post in english? I don't understand german... :/

# EDIT #
I've checked english version of manual and set this variable to 1 (it was 0), but is remote URL dosn't mean that it should include external file from other site? Howewer, it didn't help.
User avatar
pico
Posts: 2595
Joined: Wed 28. Jul 2004, 18:04
Location: Frankfurt/M Germany
Contact:

Post by pico »

Hi

Pappnase means:

look into your conf.inc.php and set

Code: Select all

$phpwcms["allow_remote_URL"] = 0;
to

Code: Select all

$phpwcms["allow_remote_URL"] = 1;
Lieber Gott gib mir Geduld - ABER BEEIL DICH
Horst - find me at Musiker-Board
st3fek
Posts: 17
Joined: Thu 4. Aug 2005, 11:17
Location: Poland, Sosnowiec
Contact:

Post by st3fek »

I did that, but nothing changes. Warning is still on the top of page.
cyrano
Posts: 1598
Joined: Sat 31. Jan 2004, 18:33
Location: Stuttgart
Contact:

Post by cyrano »

sorry about ot exactly know what's wrong - may be the used script isn't working right?
May be you try another external php script to check that it depends on the used code?

btw: you have a quiet nice photo gallery - great macro shots.
Gruß/ regards cyrano
--------------------------------------------------------
templates -> http://www.128.weitzelmedia.de
planepix -> http://www.planepix.de
XING -> https://www.xing.com/profile/Thomas_Weitzel3
st3fek
Posts: 17
Joined: Thu 4. Aug 2005, 11:17
Location: Poland, Sosnowiec
Contact:

Post by st3fek »

cyrano wrote:sorry about ot exactly know what's wrong - may be the used script isn't working right?
May be you try another external php script to check that it depends on the used code?
This script is correct for sure, because I've pasted it in [PHP][/PHP] tag and it working fine. I've made also very simple script, and put it into header, but the same problem was here - it dosn't working.
I wrote:

Code: Select all

<?PHP

echo '--- true <b>true</b> ---';

?>
but nothing was printed on page.
cyrano wrote: btw: you have a quiet nice photo gallery - great macro shots.
Thanks. :) I like macro photography, but I'm still learning...
zayebis
Posts: 1
Joined: Thu 4. Aug 2005, 19:50

Here is it!

Post by zayebis »

Find this code in include\inc_front\front.func.inc.php in the row about 1627 (function include_ext_php()). See the last row of code example:

$this_path = str_replace("\\", '/', dirname(realpath($inc_file)));
$this_path = preg_replace('/\/$/', '', $this_path);

$root_path = str_replace("\\", '/', realpath(PHPWCMS_ROOT));
$root_path = preg_replace('/\/$/', '', $root_path);

(HIER!) if(strpos($this_path, $root_path) === 0) $t = 1;

I don't know why the author checks if your path includes the root. You have to write {PHP:your_root/your-script.php} or check your PHPWCMS_ROOT or add $this_path = PHPWCMS_ROOT."/"; and so one....

Enjoy it!
st3fek
Posts: 17
Joined: Thu 4. Aug 2005, 11:17
Location: Poland, Sosnowiec
Contact:

Post by st3fek »

zayebis, thanks! It help :)
I just did that:

Code: Select all

1642 		// if(strpos($this_path, $root_path) === 0) $t = 1;
1643		 $t = 1;
Because my PHPWCMS_ROOT gives "/" ( $phpwcms["root"] = ""; )
Well, this is only temporary solution - I'll work on it when I come back home.
Post Reply