newseingabe.php :
newsspeichern.php :
Problem, mes funktioniert alles, aber die if abfrage nach dem Passwort wird immer als richtig ausgewertet, was habe ich falsch gemacht?????
Ja, ihr müsst nicht alle motzen, ich weiß das das kein sauberes phpist.
Code:
<html> <head> <title>Newseingabe</title> </head> <body> <div align="center"> <h2>News eingeben</h2> <form action="newsspeichern.php" method="post"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td>Autor:</td> <td><input type="text" maxlenght="25" size="20" name="autor"></td> </tr> <tr> <td>Überschrift:</td> <td><input type="text" size="50" name="titel"></td> </tr> <tr> <td>Passwort:</td> <td><input type="password" size="50" name="passwortnews"></td> </tr> <tr> <td>News:</td> <td><textarea rows="15" cols="50" name="neuernewstext"></textarea></td> </tr> <tr> <td>Bild:</td> <td> <input type="radio" name="bild" value="http://germanlostsouls.de/datapics/info.gif">Info <input type="radio" name="bild" value="http://germanlostsouls.de/datapics/wc3.jpg">WC3 <input type="radio" name="bild" value="http://germanlostsouls.de/datapics/cs.bmp">CS <input type="radio" name="bild" value="http://germanlostsouls.de/datapics/fun.gif">Fun </td></tr> <tr> <td colspan="2"> <input type="reset" value="löschen"><input type="submit" name="newssaven" value="News Speichern"></td> </tr> </table> </form> </div> </body> </html>
Code:
<?php
if ($_POST["passwortnews"]] = "meinpasswort"){
$newstxt = 'news.txt';
$oeffnedat = fopen("news.txt","r+");
$alterinhalt = fread($oeffnedat, filesize ($newstxt));
$datum = date("d.m.y");
$zueins = fclose($oeffnedat);
$neuertext = "<table width=100% border=0 cellspacing=2 cellpadding=0><tr><td class=thead><img src=bild>[$datum] $titel</td></tr><tr><td class=tbody>
$neuernewstext ($autor)</p></td></tr></table>$alterinhalt";
$oeffnedata = fopen("news.txt","r+");
$neuerinhalt = fwrite($oeffnedata, $neuertext);
$zuzwei = fclose($oeffnedata);
}
else{
echo "Sie besitzen Keiner Rechte um News zu schreiben!";
}
?>
Problem, mes funktioniert alles, aber die if abfrage nach dem Passwort wird immer als richtig ausgewertet, was habe ich falsch gemacht?????
Ja, ihr müsst nicht alle motzen, ich weiß das das kein sauberes phpist.

Kommentar