Guest_imported
New member
- Jan 1, 1970
- 0
<?php
$fout = 0;
if ((strlen($email)<2))
{
$foutmelding = "<font color=white><b><li>U heeft een ongeldig emailadres ingegeven";
$fout = 1;
}
if(strlen($reactie) < 2)
{
if($fout==1)
$foutmelding .= "<BR><li> U heeft geen reactie ingegeven</font></b>";
else
{
$foutmelding = "<li>U heeft geen reactie ingegeven</font></b>";
$fout=1;
}
}
else
$foutmelding .="</font></b>";
if ($naam==""
$naam="Anoniem";
if($fout==1)
{
header("Location:gastenboek.php?naam=$naam&email=$email&reactie=$reactie&foutmelding=$foutmelding"
exit;
}
else
{
$bestand = "reacties.html";
$bestandsindex = fopen($bestand,"r+"
for($i=0;$i<count($bestandsindex);$i++)
if($bestandsindex[$i] == "<!-- reacties -->"
fwrite($bestandsindex,"<br>Naam: $naam <br>E-mail: $email <br>Reactie:<br>$reactie<br><hr>"
fclose($bestandsindex);
}
header("Location:reacties.html"
?>
If you take a look at the last else clause, you'll see a for clause. In this clause I use the $i variable to see if the line in that html file corresponds with the string "<!-- reacties -->". If this is the case, the string in the fwrite clause has to be inserted between that line and the rest of the html file. But is doesn't work. They've already told me to use fseek, but this requires an offset and I don't know how many bites it is to that line. I know that my method works in Perl, but it doesn't seem to work in PHP. Can someone help me ?
$fout = 0;
if ((strlen($email)<2))
{
$foutmelding = "<font color=white><b><li>U heeft een ongeldig emailadres ingegeven";
$fout = 1;
}
if(strlen($reactie) < 2)
{
if($fout==1)
$foutmelding .= "<BR><li> U heeft geen reactie ingegeven</font></b>";
else
{
$foutmelding = "<li>U heeft geen reactie ingegeven</font></b>";
$fout=1;
}
}
else
$foutmelding .="</font></b>";
if ($naam==""
$naam="Anoniem";
if($fout==1)
{
header("Location:gastenboek.php?naam=$naam&email=$email&reactie=$reactie&foutmelding=$foutmelding"
exit;
}
else
{
$bestand = "reacties.html";
$bestandsindex = fopen($bestand,"r+"
for($i=0;$i<count($bestandsindex);$i++)
if($bestandsindex[$i] == "<!-- reacties -->"
fwrite($bestandsindex,"<br>Naam: $naam <br>E-mail: $email <br>Reactie:<br>$reactie<br><hr>"
fclose($bestandsindex);
}
header("Location:reacties.html"
?>
If you take a look at the last else clause, you'll see a for clause. In this clause I use the $i variable to see if the line in that html file corresponds with the string "<!-- reacties -->". If this is the case, the string in the fwrite clause has to be inserted between that line and the rest of the html file. But is doesn't work. They've already told me to use fseek, but this requires an offset and I don't know how many bites it is to that line. I know that my method works in Perl, but it doesn't seem to work in PHP. Can someone help me ?