Thank's Chris!
I'm afraid the problem is even.. worse?
It seems to me that there's no way (?)
that my PHP code parsed as php at all;
meaning there's no way to fiddle with
strings and use eval to get the output?
A quick example:
I have a testpage, all made of PHP, just
echoing out the HTML. In this page I have
a PHPlink to the body content body of the
page:
<?php
..
echo "<body..>";
if($con = pg_connect('host=localhost port=5432 user=wp dbname=html')){
$res = pg_exec($con, 'select content from wpcont where no=17');
if(!$res){ echo 'Got connection but no result!';}
else{
$row = pg_fetch_row($res, 0); echo $row[0] . ' ';}
pg_close($con);}
else{
echo 'Got no connection!';}
echo "</body>";
echo "</html>";
..
?>
so - the contents then, look like
ola : [ 21:14 ] # psql -d html << !
? select content from wpcont where no=17;
? !
content
<?php
$a = "echo phpversion();";
eval($a);
?>
(1 row)
which doesn't work, of course. I'm thinkin,
yeah, I've wrapped PHP code within PHP
code - nothing displays in my browser.
When I try this code directly in my php
page instead, I get PHP parse error -
you simply cannot have
<?php
..
<?php
?>
?>
Ok. Fine I think to myself. Don't understand
why I don't get this error just because I
fetch the code from my database but ok -
I just remove the PHP tags then - this should
sure work..? Thus, the content in my db is
now:
ola : [ 21:15 ] # psql -d html << !
? select content from wpcont where no=18;
? !
content
$a = "echo phpversion();";
eval($a);
This should work, huh? Guess what - now
these strings are treated like any crappy
HTML strings - my browser simply displays
$a = "echo phpversion();"; eval($a);
Where's the logic in this? It seems to me,
whatever you do, you can never fetch
PHP code from a database? Either it is
simply ignored (like in my first case) or
it is just assumed that whatever you fetch,
this always goes like any HTML output..
Between these things, there's no
alternative?
I dunno, perhaps there's some deep
misconception here, I'm a beginner with
PHP. But it will be much quicker for me
rewriting the java code I use for building
these PHP pages instead of getting my
PHP to work. Who knows, perhaps it's
one of those
ob_start();
things. Somehow when I mixed php and
HTML at some point, everything just
stopped working all of a sudden. I then
more or less randomly added some of
these outputbuffercleaner-things and somehow it got working again.
Never understood how or why - just as
with this sql-thing.
PHP doesn't exactly strike me as the
most stringent thing around, but hey -
what do I know.
Anyway - thank's for you help Chris!
Best regards/s