note 29927 added to function.ereg

From: Date: Fri, 28 Feb 2003 23:37:47 +0000
Subject: note 29927 added to function.ereg
Groups: php.notes 
Request: Send a blank email to php-notes+get-44681@lists.php.net to get a copy of this message
to elaberate on the above, I found that in php4 you will recieve an Invalid content \ {\} content error. if(!@fopen($F_TEMPLATE, "r")) file2go2($F_NOTSENT); else $arr_t1 = @file( $F_TEMPLATE ); $nr_mail = 1; if (! $F_TEMPLATE2 == "" && !@fopen($F_TEMPLATE2, "r")) file2go2($F_NOTSENT); if (! $F_TEMPLATE2 == "" && @fopen($F_TEMPLATE2, "r")) $arr_t2 = @file( $F_TEMPLATE2 ); $nr_mail = 2; $domail = 1; while ($domail <= $nr_mail): if ($domail == 1) $var2use = $arr_t1; else $var2use = $arr_t2; for ($index = 0; $index < count($var2use); $index++) { $pattern = ereg("{{[A-z0-9_]*}}", $var2use[$index]); if ($pattern) { $line = ereg_replace("{{","$",$var2use[$index]); $line = ereg_replace("}}","",$line); } else { $line = $var2use[$index]; } $line = addslashes($line) . "<br>"; eval( "\$line = \"$line\";" ); if ($index == 0 && $domail == 1) $linetot1 = $line; elseif ($index > 0 && $domail == 1) $linetot1 .= $line; if ($index == 0 && $domail == 2) $linetot2 = $line; elseif ($index > 0 && $domail == 2) $linetot2 .= $line; } ++$domail; endwhile; if you but stripslashes("$line") after the eval() this should work. -- http://www.php.net/manual/en/function.ereg.php http://master.php.net/manage/user-notes.php?action=edit+29927 http://master.php.net/manage/user-notes.php?action=delete+29927 http://master.php.net/manage/user-notes.php?action=reject+29927

« previous php.notes (#44681) next »