fgets and eval

From: Date: Wed, 19 Dec 2001 05:04:17 +0000
Subject: fgets and eval
Groups: php.general 
Request: Send a blank email to php-general+get-78172@lists.php.net to get a copy of this message
Hello all, Okay here is the situation. I am reading a file using fgets up until I hit a certain delimiter within the text. No problem there. This text file may or may not contain php in the format <? blah ?>. So I now have two variables $header and $footer which may or may not contain some php within them. I need to echo the variables at the top and bottom of other files but need any php that may be in there to execute. I tried echo(eval($header)) and I also tried $header = addslashes($header); eval("\$header = \"$header\";"); $header= stripslashes($header); echo($header); The first produces and error, the second produces no error however only variables evaluate while actual commands, such as echo just get written into the code. Any idea what I may be doing wrong here? Thanks, Gerard

« previous php.general (#78172) next »