Page 1 of 1

Problem parsing PHP tag or front.func.inc.php?

Posted: Tue 18. May 2004, 10:57
by kpimichael
I upgraded to the new version 05/08. Now for some reason my external php code will not execute. I checked to make sure the security patches were applied. They were. My php code is outside the phpwcms path. I have it fully qualified as such:

Code: Select all

{PHP:/home/where/public_html/s2/my_external.php}
my path to phpwcms is:

Code: Select all

/home/where/public_html/phpwcms
when i add the tag to a page, nothing happens, no errors, nothing.

I compared the latest version with what i have on site and they both match so the code is uploaded correctly.

So it looks like there is a parsing problem for the {PHP} tag

I went back to the phpwcms_1.1-RC4_2004-05 and my php code works fine.

Is anyone else having a problem with this?

Thanks, Michael

Posted: Tue 18. May 2004, 11:15
by pSouper
i find this too :(
more importantly does anyone ave this WORKING? then we'll know if is our fault ;)

Posted: Tue 18. May 2004, 13:51
by DeXXus
http://cvs.sourceforge.net/viewcvs.py/p ... ortby=date
CVS log for phpwcms/phpwcms_v1/include/inc_front/front.func.inc.php
Revision 1.3 - (download), view (text) (markup) (annotate) - [select for diffs]
Fri May 7 23:16:31 2004 UTC (10 days, 11 hours ago) by slackero
Changes since 1.2: +33 -6 lines
Diff to previous 1.2
security problem solved (I hope) - there was a possible injection via form field in frontend where remote files could be included without any check. Now all {PHP...} replacement tags are removed when forms are posted. And it's only possible to include files located in own web root.

Posted: Tue 18. May 2004, 19:41
by Oliver Georgi
It's no parsing error. It checks against the correct path. And path of included php file and phpwcms installation has to be equal.

There are 2 possible workarounds:

1) Include a correct php script that includes your "old" php script too.
2) place your php script into a secured subdir that's not readable from outside by using .htaccess/.htpasswd

I had to implement this for security reasons.

Oliver

Thanks DeXXus

Posted: Tue 18. May 2004, 19:46
by kpimichael
Looks like i need to learn to read. I moved code inside the root for phpwcms and all is well with the world again. Thanks for taking the time to respond.

Posted: Wed 19. May 2004, 09:40
by pSouper
understanding that i am a total spanner... does this all mean I must have myfile.php in my phpwcms root dir for it to work? this is not working for me,
myfile.php is only...

Code: Select all

<?
echo "php include test";
?>
but I get nada :(

any step by step hotwto would be very marmly welcome :)

Posted: Wed 19. May 2004, 11:32
by Oliver Georgi
false ;-)

Code: Select all

<?php
include('/path/to/myfile.php'); 
?>
Oliver

Posted: Wed 19. May 2004, 11:57
by pSouper
Hi O,

in my article I use..

Code: Select all

{PHP:phpmyinclude.php}
then in my phpwcms root dir I create a file..

Code: Select all

<?PHP
echo "I am here";
include ('/include/inc_ext/myscripts/myfile.php');
?>
I get nothing, no echo and no include :?

so i am a spanner for sure :(

Posted: Wed 19. May 2004, 12:35
by DeXXus
pSouper wrote:I get nothing, no echo and no include :?
Hmmm, the echo should work fine... but you probably need to change the include path to have the "leading period of relativity" (-not- Leaning Tower of Pisa... pay attention pSouper) ;-)

Code: Select all

<?PHP 
echo "I am here"; 
include ('./include/inc_ext/myscripts/myfile.php'); 
?>
pSouper wrote:so i am a spanner for sure :(
Only if you think I meant "Leaning Tower of Pisa" ...up above :lol:

Posted: Wed 19. May 2004, 12:46
by pSouper
nada :( with or without the ./ (now i am 'leaning towards pizza' for sure :D

Posted: Wed 19. May 2004, 12:57
by DeXXus
I did it like this (in an article and in the template):

Code: Select all

{PHP:phpmyinclude.php}
In "root" of phpWCMS, I created "phpmyinclude.php"

Code: Select all

<?PHP 
echo "I am here"; 
include ('./scripts/test_form.inc.php'); 
?>
In subfolder "scripts" (subfolder of "root" of phpWCMS), I created "test_form.inc.php" (Oliver's sample form element):

Code: Select all

<hr> 
<strong>Post-Test</strong> 
<?php if(!$_POST["count_submit"]) { ?> 
<form action="<?php echo $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'] ?>" method="post" name="myposttest" id="myposttest"> 
counter&nbsp;<input name="counter" type="text" id="counter">&nbsp;<input name="count_submit" type="submit" id="submit" value="send"> 
</form> 
<?php } else { ?> 
your counter value: <?php echo $_POST["counter"] ?><br> 
<a href="<?php echo $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'] ?>">fill in again</a><?php } ?> 
<hr>

Posted: Wed 19. May 2004, 13:36
by pSouper
Thanks D,
no joy.
but I know the problem is not my code :)
I will through a new set of files over the top and see what happens :fingers +'d: What no icon for that :? :D