Mr.Fies
Mitglied
Hi, ich habe ein Adminscript für mein Newsscript geschrieben. Mein Problem ist nur das es beim durchlaufen alle HTML Tags kaput macht und ich habe keine Ahnung wiso?
Aus
<font color="#000000"> wird <font color=\"#000000\">
Bei jedem Durchlauf wird ein weiter \ vor ein " gesetzt.
Ich hoffe ihr versteht was ich meine und könnt mir helfen.
Aus
<font color="#000000"> wird <font color=\"#000000\">
Bei jedem Durchlauf wird ein weiter \ vor ein " gesetzt.
PHP:
<?
$datei = "news.txt";
$file = file($datei);
$zahl = count($file);
//***********************************
$ok = "<b>Warte auf Eintrag...</b>";
if($action == "submit"){
for($x = 0; $x <= $zahl - 1; $x++){
$n = "||";
$nl = "\n";
if($loeschen[$x] == "Ja"){
$news_neu .= "";
$ok = "<b>Eintrag wurde erfolgreich gelöscht.</b>";
}
else{
$newss[$x] = ereg_replace("\n","<br>",$newss[$x]);
$newss[$x] = str_replace("[com]","<br><br><b>Update:</b><br><i>",$newss[$x]);
$newss[$x] = str_replace("[/com]","</i>",$newss[$x]);
$news_neu .= "$titel[$x]$n$newss[$x]$n$name[$x]$n$date[$x]$nl";
}
}
$fp = fopen($datei,"w");
fputs($fp,$news_neu);
fclose($fp);
$ok = "<b>Eintrag erfolgreich hinzugefügt, $zahl Einträge in der Datenbank.</b>";
}
else{
echo "
<form method=\"POST\" action=\"\">
<table cellspacing=\"2\" cellpadding=\"0\">
<tr>
<td align=\"left\" valign=\"middle\" class=\"normal\">
<b>CODE:</b>[com]Hier den neuen Text[/com]
</td>
</tr>
<tr>
";
//***********************************
for($x = 0; $x <= $zahl - 1; $x++){
$get = explode("||", $file[$x]);
$get[1] = ereg_replace("<br>","",$get[1]);
//***********************************
if($x%2){
$color = "#585858";
}
else{
$color = "#646464";
}
//***********************************
echo "
<td align=\"left\" valing=\"middle\" bgcolor=\"$color\" class=\"normal\">
<input name=\"titel[$x]\" type=\"text\" size=\"40\" maxlength=\"100\" value=\"$get[0]\" class=\"box\"><br>
</td>
</tr>
<tr>
<td align=\"left\" valing=\"middle\" bgcolor=\"$color\" class=\"normal\">
<textarea name=\"newss[$x]\" rows=\"8\" cols=\"35\" maxlength=\"5000\" class=\"box_area\">$get[1]</textarea>
</td>
</tr>
<tr>
<td align=\"left\" valing=\"middle\" bgcolor=\"$color\" class=\"normal\">
<input name=\"name[$x]\" type=\"text\" size=\"40\" maxlength=\"100\" value=\"$get[2]\" class=\"box\"><br>
<input name=\"date[$x]\" type=\"text\" size=\"40\" maxlength=\"100\" value=\"$get[3]\" class=\"box\">
</td>
</tr>
<tr>
<td align=\"left\" valign=\"middle\" class=\"normal\">
<b>löschen?:</b>
<select name=\"loeschen[$x]\" size=\"1\" class=\"box_drop\">
<option selected> Nein
<option> Ja
</select>
<hr color=\"#000000\">
</td>
</tr>
";
}
echo "
<tr>
<td align=\"left\" valign=\"middle\" class=\"normal\">
<br>
<input type=\"submit\" name=\"action\" value=\"submit\" class=\"button\">
</td>
</tr>
</table>
</form>
";
}
echo "
<br>
<br>
$ok
";
Ich hoffe ihr versteht was ich meine und könnt mir helfen.