könnt ihr mir sagen was an diesem Script falsch ist ? es löscht und edititiert nicht

-GS-Master

Erfahrenes Mitglied
mein Script löscht und editiert meine Einträge nicht, ich weiß jedoch nicht warum ... müsst glaub ich eigentlich funktionieren

PHP:
<?php

if ($submit != "")
{

if($_POST["delete"]=="yes")
{


$log =  "GS/files/guestbook.master";  
$fp = fopen($log,"r");  
$array = file($log);  
$anzahl2 = count($array);  
$id = $j;   
$eintrag = explode("|-|",$array[$id]);  

   global $log,$array,$anzahl2,$id;  
   if ($anzahl2 == 0){  
   echo"Konnte keinen Eintrag loeschen!";  
     
   }else{  
          
        $zeile = $id;  
 
If ($anzahl2 <= $zeile){  

 
}else{  

unset($array[$zeile]);  

$newinhalt = fopen($log,"w");  
fputs($newinhalt,implode("",$array));  
fclose($newinhalt); 
header("Refresh: 0; URL=index.php");  
}  

}  


}else{  

		include("functions.php");
		$text=$_POST["text"];
		$text=htmlentities($text);
		$text=replacetags($text);

$db = "GS/files/guestbook.master";
$inhalt = file($db);
$anzahl = count($inhalt);
$nr = $j;
$replace_1 = "$today";
$replace_2 = "$name";
$replace_3 = "$icq";
$replace_4 = "$email";
$replace_5 = "$homepage";
$replace_6 = "$titelicon";
$replace_7 = "$titel";
$replace_8 = "$rein";

for ($x=0;$x<$anzahl;$x++)
    {
    $rep_old = "$inhalt[$nr]";
    $inhalt[$nr] = str_replace("$rep_old","$rep_neu",$inhalt[$nr]);
    }

$fp = fopen($db,"w");
for($i = 0;$i<$anzahl;$i++)
    {
    $schreibe[$i] = trim($inhalt[$i]);
    fwrite($fp,$schreibe[$i]."\n",1024);
    }
fclose($fp);
}

} 
else 
{   

$Zeile[7] = str_replace('<u>', '[ u]', $Zeile[7]);
$Zeile[7] = str_replace('</u>', '[ /u]', $Zeile[7]);

$Zeile[7] = str_replace('<center>', '[ c]', $Zeile[7]);
$Zeile[7] = str_replace('</center>', '[ /c]', $Zeile[7]);

$Zeile[7] = str_replace('<b>', '[ b]', $Zeile[7]);
$Zeile[7] = str_replace('</b>', '[ /b]', $Zeile[7]);

$Zeile[7] = str_replace('<i>', '[ i]', $Zeile[7]);
$Zeile[7] = str_replace('</i>', '[ /i]', $Zeile[7]);

$Zeile[7] = str_replace('<p align=right>', '[ rightside]', $Zeile[7]);
$Zeile[7] = str_replace('</p>', '[ /rightside]', $Zeile[7]);


$Zeile[7] = str_replace('<font color=#FF0000>', '[color=#FF0000]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#FF00FF>', '[color=#FF00FF]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#FFA500>', '[color=#FFA500]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#FFFF00>', '[color=#FFFF00]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#00FF00>', '[color=#00FF00]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#9ACD32>', '[color=#9ACD32]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#00FFFF>', '[color=#00FFFF]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#00BFFF>', '[color=#00BFFF]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#4169E1>', '[color=#4169E1]', $Zeile[7]);
$Zeile[7] = str_replace('<font color=#9932CC>', '', $Zeile[7]);

$Zeile[7] = str_replace('</font>', '', $Zeile[7]);
$Zeile[7] = str_replace('<br />', '
', $Zeile[7]);
     
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon1.gif>", "icon1", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon2.gif>", "icon2", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon3.gif>", "icon3", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon4.gif>", "icon4", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon5.gif>", "icon5", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon6.gif>", "icon6", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon7.gif>", "icon7", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon8.gif>", "icon8", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon9.gif>", "icon9", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon10.gif>", "1icon", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon11.gif>", "2icon", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon12.gif>", "3icon", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon13.gif>", "4icon", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon14.gif>", "5icon", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon15.gif>", "6icon", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon16.gif>", "7icon", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon17.gif>", "8icon", $Zeile[5]);
$Zeile[5] = str_replace("<img width=15 height=15 src=GS/images/icons/icon18.gif>", "9icon", $Zeile[5]);

$Zeile[7] = str_replace("<img width=16 height=20 src=GS/images/Smilies/ugly_23.gif>", ":denk:", $Zeile[7]);
$Zeile[7] = str_replace("<img width=15 height=15 src=GS/images/Smilies/smile09.gif>", "?", $Zeile[7]);
$Zeile[7] = str_replace("<img width=15 height=15 src=GS/images/Smilies/smile08.gif>", ":-(", $Zeile[7]);
$Zeile[7] = str_replace("<img width=15 height=15 src=GS/images/Smilies/smile06.gif>", "8-)", $Zeile[7]);
$Zeile[7] = str_replace("<img width=15 height=15 src=GS/images/Smilies/smile03.gif>", ":-0", $Zeile[7]);
$Zeile[7] = str_replace("<img width=15 height=15 src=GS/images/Smilies/smile02.gif>", ";-)", $Zeile[7]);
$Zeile[7] = str_replace("<img width=16 height=16 src=GS/images/Smilies/smile01.gif>", ":-)", $Zeile[7]);
$Zeile[7] = str_replace("<img width=15 height=15 src=GS/images/Smilies/icon18.gif>", ":-]", $Zeile[7]);
$Zeile[7] = str_replace("<img width=26 height=25 src=GS/images/Smilies/army19.gif>", ":blemblem:", $Zeile[7]);
$Zeile[7] = str_replace("<img width=25 height=25 src=GS/images/Smilies/army13.gif>", ":crazy:", $Zeile[7]);
$Zeile[7] = str_replace("<img width=33 height=27 src=GS/images/Smilies/army11.gif>", ":sterne:", $Zeile[7]);
?> 
 
<html>
<head>
<script src="functions.js" type="text/javascript"></script>
</head>
<body text="#FFFFFF">
<form name="messageform" method="post" action="gbedit.php">

<div align="center">
  <center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="400" id="AutoNumber3" background="" height="16">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="400" id="AutoNumber1" background="">
  <tr>
    <td>
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="383" id="AutoNumber2" height="449">
        <tr>
          <td height="16" colspan="3" width="383"></td>
        </tr>
        <tr>
          <td height="23" width="72" align="center"><font size="2">Name</font></td>
          <td height="23" colspan="2" width="311">
          <font color="#FFFFFF">
          <!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" b-value-required="TRUE" i-maximum-length="15" --><input name="name" type="text" class="gbInput" id="gbName" size="45" style="color: #FFFFFF; background-color: #333333" maxlength="15" value="<?php echo  $Zeile[1] ?>"></font></td>
        </tr>
        <tr>
          <td height="12" width="72" align="center">icq</td>
          <td height="12" colspan="2" width="311">
          <font color="#FFFFFF">
          <!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" s-allow-other-chars="@" --><input name="icq" type="text" class="gbInput" id="gbName5" size="45" style="color: #FFFFFF; background-color: #333333" value="<?php echo $Zeile[2] ?>"></font></td>
        </tr>
        <tr>
          <td height="11" width="72" align="center"><font size="2">e-Mail</font></td>
          <td height="11" colspan="2" width="311">
          <font color="#FFFFFF">
          <!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" s-allow-other-chars="@" --><input name="email" type="text" class="gbInput" id="gbName0" size="45" style="color: #FFFFFF; background-color: #333333" value="<?php echo $Zeile[3] ?>"></font></td>
        </tr>
        <tr>
          <td height="23" width="72" align="center"><font size="2">Homepage</font></td>
          <td height="23" colspan="2" width="311">
          <font color="#FFFFFF">
          <!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" --><input name="homepage" type="text" class="gbInput" id="gbName2" size="45" style="color: #FFFFFF; background-color: #333333" value="<?php echo $Zeile[4] ?>"></font></td>
        </tr>
        <tr>
          <td height="63" width="72" align="center"><font size="2">Icon</font></td>
          <td height="63" width="27">&nbsp;</td>
          <td height="63" width="284">
          <a href="javascript:addsmilieicon('icon1');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon1.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('icon2');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon2.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('icon3');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon3.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('icon4');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon4.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('icon5');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon5.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('icon6');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon6.gif" width="15" height="15"></a><br>
          <a href="javascript:addsmilieicon('icon7');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon18.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('icon8');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon17.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('icon9');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon16.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('1icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon15.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('2icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon14.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('3icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon13.gif" width="15" height="15"></a><font size="2"> 
          Bitte wählen Sie einen Icon </font>
          <br><a href="javascript:addsmilieicon('4icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon12.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('5icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon11.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('6icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon10.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('7icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon9.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('8icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon8.gif" width="15" height="15">
          <a href="javascript:addsmilieicon('9icon');" style="text-decoration: none">
          <img border="0" src="GS/images/icons/icon7.gif" width="15" height="15"></td>
        </tr>
        <tr>
          <td height="23" width="72" align="center"><font size="2">Titel</font></td>
          <td height="23" colspan="2" width="311">
          <font color="#FFFFFF">
          <!--webbot bot="Validation" s-display-name="------" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" --><input name="titelicon" type="text" class="gbInput" id="gbName4" size="6" style="color: #FFFFFF; background-color: #333333" value="<?php echo $Zeile[5] ?>"><!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="5" i-maximum-length="40" --><input name="titel" type="text" class="gbInput" id="gbName3" size="36" style="color: #FFFFFF; background-color: #333333" maxlength="40" value="<?php echo $Zeile[6] ?>"></font></td>
        </tr>
        <tr>
          <td height="40" width="72" align="center"><font size="2">BBCode</font></td>
          <td height="40" colspan="2" width="311">
          <p align="center"><a href="javascript:formattedtext('b');">
            <img border="0" src="GS/images/icons/bbcodefett.gif" width="23" height="22"></a><a href="javascript:formattedtext('i');"><img border="0" src="GS/images/icons/bbcodecursiv.gif" width="23" height="22"></a><a href="javascript:formattedtext('u');"><img border="0" src="GS/images/icons/bbcodeunterstrichen.gif" width="23" height="22"></a><a href="javascript:formattedtext('c');"><img border="0" src="GS/images/icons/bbcodecentriert.gif" width="23" height="22"></a><a href="javascript:formattedtext('rightside');"><img border="0" src="GS/images/icons/bbcoderigtside.gif" width="23" height="22"></a><br><a href="javascript:colortext('#FF0000');"><img border="0" src="GS/images/icons/farbe0.gif" width="15" height="15"></a><a href="javascript:colortext('#FF00FF');"><img border="0" src="GS/images/icons/farbe1.gif" width="15" height="15"></a><a href="javascript:colortext('#FFA500');"><img border="0" src="GS/images/icons/farbe2.gif" width="15" height="15"></a><a href="javascript:colortext('#FFFF00');"><img border="0" src="GS/images/icons/farbe3.gif" width="15" height="15"></a><a href="javascript:colortext('#00FF00');"><img border="0" src="GS/images/icons/farbe4.gif" width="15" height="15"></a><a href="javascript:colortext('#9ACD32');"><img border="0" src="GS/images/icons/farbe5.gif" width="15" height="15"></a><a href="javascript:colortext('#00FFFF');"><img border="0" src="GS/images/icons/farbe6.gif" width="15" height="15"></a><a href="javascript:colortext('#00BFFF');"><img border="0" src="GS/images/icons/farbe7.gif" width="15" height="15"></a><a href="javascript:colortext('#4169E1');"><img border="0" src="GS/images/icons/farbe8.gif" width="15" height="15"></a><a href="javascript:colortext('#9932CC');"><img border="0" src="GS/images/icons/farbe9.gif" width="15" height="15"></a></td>
        </tr>
        <tr>
          <td height="148" width="72" align="center"><font size="2">Kommentar</font></td>
          <td height="148" colspan="2" width="311">
          <p align="left">
<!--webbot bot="Validation" i-maximum-length="500" --><textarea name="text" cols="34" rows="9" style="color: #FFFFFF; background-color: #333333"><?php echo $Zeile[7] ?></textarea></td>
        </tr>
        <tr>
          <td height="31" width="72" align="center"><font size="2">Smilies</font></td>
          <td height="31" colspan="2" width="311">
          <p align="center"><a href="javascript:addsmilie(':denk:');">
          <img border="0" src="GS/images/Smilies/ugly_23.gif" width="16" height="20"></a>&nbsp;<a href="javascript:addsmilie('?');"><img border="0" src="GS/images/Smilies/smile09.gif" width="15" height="15"></a>
          <a href="javascript:addsmilie(':-(');">
          <img border="0" src="GS/images/Smilies/smile08.gif" width="15" height="15"></a>
          <a href="javascript:addsmilie('8-)');">
          <img border="0" src="GS/images/Smilies/smile06.gif" width="15" height="15"></a>
          <a href="javascript:addsmilie(':-0');">
          <img border="0" src="GS/images/Smilies/smile03.gif" width="15" height="15"></a>
          <a href="javascript:addsmilie(';-)');">
          <img border="0" src="GS/images/Smilies/smile02.gif" width="15" height="15"></a>
          <a href="javascript:addsmilie(':-)');">
          <img border="0" src="GS/images/Smilies/smile01.gif" width="16" height="16"></a>
          <a href="javascript:addsmilie(':-]');">
          <img border="0" src="GS/images/Smilies/icon18.gif" width="15" height="15"></a>
          <a href="javascript:addsmilie(':blemblem:');">
          <img border="0" src="GS/images/Smilies/army19.gif" width="26" height="25"></a>
          <a href="javascript:addsmilie(':crazy:');">
          <img border="0" src="GS/images/Smilies/army13.gif" width="25" height="25"></a>
          <a href="javascript:addsmilie(':sterne:');">
          <img border="0" src="GS/images/Smilies/army11.gif" width="33" height="27"></a></td>
        </tr>
        <tr>
          <td height="37" width="72" align="center">&nbsp;</td>
          <td height="37" colspan="2" width="311">
<input type="radio" name="delete" value="no" checked />edit
<input type="radio" name="delete" value="yes" />dell
<input type="submit" name="submit" value="Eintragen"></td>
        </tr>
      </table>
      </center>
    </div>
    </td>
  </tr>
  </table>
  </center>
</div>
<p>
&nbsp;</p>
</form>
</font></font></font></font></font></font></font></font></font>
</body>
</html>
<?php
}
?>
 
ich hab mir das jetzt nicht genauer angeschaut aber testest du das script auf einem Windwos System dann müsstest du zu fopen noch das "b" Flag übergeben [phpf]fopen[/phpf].
 
Zurück