You are here: strpos for <? and ?> problem « PHP Programming Language « IT news, forums, messages
strpos for <? and ?> problem

Posted by julian_m on 10/10/55 11:39

file AddHTML.htm:
----------------------------
This line is <b>ok</b><br>
This line is <b>ok</b><br>
This line is <b>ok</b><br>
<?PHP echo "This one has code prohibited "; ?>
This line is <b>ok</b><br>
This line is <b>ok</b><br>
----------------------------


file index.php
------------
<html><head .... all you know here

<?PHP
function p_function_AddOnlyHTML($AL_file)
{
$handle = fopen($AL_file, "r");
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
//if (strpos($buffer, '&lt;?') === true){
if (strpos($buffer, '<?') === true){
echo "El archivo contiene código PHP<br>";
return false;
}

echo $buffer;
}
fclose($handle);
}


p_function_AddOnlyHTML("AddHTML.htm");

?>


It actually prints

This line is ok
This line is ok
This line is ok
This line is ok
This line is ok

whereas I would expect

This line is ok
This line is ok
This line is ok

beacause, after 3rds line, function p_function_AddOnlyHTML should find
a '<?' occurrence

Any hints? I'm really lost...

regards - jm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация