Servus,
Ich habe mich mal daran versucht einen eigenen kleinen CMS (content management system) zu machen allerdings habe ich ein problem, wenn die ich eine datei in einer textarea auslesen, wirt nur die erste Zeile im textarea angezeigt ....
Hier mal mein Code:
PHP-Code:
<?PHP
###################################
###################################
##Smart#Content-Management-System##
###############SCMS################
#############by Gokel##############
###################################
###################################
// Kann belibig verändert werden
$password = "123";
// Ab hier nichts mehr verändern !
$password_eingabe = $_POST['1'];
$seite = $_POST['2'];
$admin_text_1 = $_POST['3'];
echo "<form action='' method='post'>
<table style='width:220px;height:*;border:1px solid yellow;background-color:green;'>
<tr>
<td style='width:170px;border:1px solid orange;'>
[b]Password [/b]</td> <td style='width:50px;border:1px solid orange;'> <input type='password' name='1';text-align:center;> </td>
</tr>
<tr>
<td colspan='2' style='border:1px solid orange;'>
[b]Welche Seite möchten sie bearbeiten? [/b]</td>
</tr>
<tr>
<td style='width:170px;border:1px solid orange;'>
Seite 1:</td> <td style='width:50px;border:1px solid orange;'> <input type='radio' name='2' value='s1'> </td>
</tr>
<tr>
<td style='width:170px;border:1px solid orange;'>
Seite 2:</td> <td style='width:50px;border:1px solid orange;'> <input type='radio' name='2' value='s2'> </td>
</tr>
<tr>
<td style='width:170px;border:1px solid orange;'>
Seite 3:</td> <td style='width:50px;border:1px solid orange;'> <input type='radio' name='2' value='s3'> </td>
</tr>
<tr>
<td style='width:170px;border:1px solid orange;'>
Seite 4:</td> <td style='width:50px;border:1px solid orange;'> <input type='radio' name='2' value='s4'> </td>
</tr>
<tr>
<td style='width:170px;border:1px solid orange;'>
Seite 5:</td> <td style='width:50px;border:1px solid orange;'> <input type='radio' name='2' value='s5'> </td>
</tr>
<tr>
<td style='width:170px;border:1px solid orange;'>
Menü:</td> <td style='width:50px;border:1px solid orange;'> <input type='radio' name='2' value='menu'> </td>
</tr>
<tr>
<td colspan='2' style='border:1px solid orange;text-align:center;'>
<input type='submit' value='einloggen'></td>
</tr>
</table>
</form>";
if($password_eingabe == $password && $seite == "s1") {
$dat = fopen("seite1.txt", "r+");
$in = fgets($dat, 5000);
echo "Editor:
<form action='' method='post'>
<div style='width:550px; height:270px;border:1px solid black;background-color:#00008B;'>
<div align='center'>
<textarea cols='60' rows='15' name='3' style='border:1px solid grey;
color:orange;background-color:black;margin-top:5px;'>$in</textarea>
</div>
</div>
<input type='submit' value='speichern'>
</form>";
fclose($dat);
}
if($admin_text_1 != "") {
$file = fopen("seite1.txt", "r+");
$inhalt = fgets($file, 5000);
echo " Erfolgreich gespeichert ";
$inhalt = $admin_text_1;
rewind($file);
fwrite($file, $inhalt);
fclose($file);
}
?>
Problem 2 : Wenn ich den text in der textarea einfach lösche, wird er nicht gelöscht ....
Ich hoffe das ihr mir helfen könnt
lg