RE: [PHP] strip php out of html

2001-11-22 Thread Joseph Blythe

David,

Basically I have found a way of making printable versions of every page in a
website I am currently working on (without a database etc), because I am
using a dreamweaver template the main content is always surrounded by:

!-- #BeginEditable content --
...
!-- #EndEditable --

Just a link on a page pointing at the script below:

-- html --
?php
$file = fopen($HTTP_REFERER, r);
if(!$file)die(Cannot open the file.);
$readfile = fread($file ,4);
$searchfile = eregi(!-- #BeginEditable \content\ --(.*)!--
#EndEditable --, $readfile ,$out);

echo $out[0];
?
-- html --

My problem is that there is a bit of php code showing in the source view
which gives away some of my included files names which I really don't want
people seeing, especially clever  people like the ones on this list :) I
don't need the php in the printable version so if I can either eval it or
strip it out that would be nice.

Regards,


Joseph

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Friday, 23 November 2001 2:28 PM
To: Joseph Blythe; [EMAIL PROTECTED]
Subject: Re: [PHP] strip php out of html


On Fri, 23 Nov 2001 14:10, Joseph Blythe wrote:
 Hello,

 Is there a way to strip only php code out of an html file? I know about
 strip_tags but its going to be alot of work to make the allowable list,
 as all I want to strip out is:

 ?php ... ?

 I tried like so:

 eregi_replace (?php include(\whatever.php\); ?, , $string);

 but it didn't find it suppose because of the escape characters...

 Another option would be to find the php code evaluate it and then put
 the result back in the correct position, I sort of tried this with not
 much luck.

 Any ideas..

 Regards,

 Joseph

It sounds like you want to capture the output of the script - so you just
end up with what you would see in View Source???

Is this a one off thing, or what exactly is the problem you are trying to
solve?

--
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA

   Always draw your curves, then plot the data.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] strip php out of html

2001-11-22 Thread Joseph Blythe

Sorry people it is actually evaluating the code I was looking at it from
inside Maguma PHP4EE studios internal preview which was not evaluating it,
after uploading it to the webserver it now is ok doh! :)

Anyway i do need to strip out the original link that points to the printable
script so that people don't click on it and point it at its self, it just
comes up blank anyway as it does not use the dreamwaever template.

Regards,

Joseph

-Original Message-
From: Joseph Blythe [mailto:[EMAIL PROTECTED]]
Sent: Friday, 23 November 2001 2:47 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] strip php out of html


David,

Basically I have found a way of making printable versions of every page in a
website I am currently working on (without a database etc), because I am
using a dreamweaver template the main content is always surrounded by:

!-- #BeginEditable content --
...
!-- #EndEditable --

Just a link on a page pointing at the script below:

-- html --
?php
$file = fopen($HTTP_REFERER, r);
if(!$file)die(Cannot open the file.);
$readfile = fread($file ,4);
$searchfile = eregi(!-- #BeginEditable \content\ --(.*)!--
#EndEditable --, $readfile ,$out);

echo $out[0];
?
-- html --

My problem is that there is a bit of php code showing in the source view
which gives away some of my included files names which I really don't want
people seeing, especially clever  people like the ones on this list :) I
don't need the php in the printable version so if I can either eval it or
strip it out that would be nice.

Regards,


Joseph

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Friday, 23 November 2001 2:28 PM
To: Joseph Blythe; [EMAIL PROTECTED]
Subject: Re: [PHP] strip php out of html


On Fri, 23 Nov 2001 14:10, Joseph Blythe wrote:
 Hello,

 Is there a way to strip only php code out of an html file? I know about
 strip_tags but its going to be alot of work to make the allowable list,
 as all I want to strip out is:

 ?php ... ?

 I tried like so:

 eregi_replace (?php include(\whatever.php\); ?, , $string);

 but it didn't find it suppose because of the escape characters...

 Another option would be to find the php code evaluate it and then put
 the result back in the correct position, I sort of tried this with not
 much luck.

 Any ideas..

 Regards,

 Joseph

It sounds like you want to capture the output of the script - so you just
end up with what you would see in View Source???

Is this a one off thing, or what exactly is the problem you are trying to
solve?

--
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA

   Always draw your curves, then plot the data.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]