1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
|
<?php
session_start();
include ("./db_config.php");
$_logindaten = ARRAY("name"=>"$username", "passwort"=>"$password");
if (isset($_POST["loginname"]) && isset($_POST["loginpasswort"]))
{
if ($_logindaten["name"] == $_POST["loginname"] &&
$_logindaten["passwort"] == $_POST["loginpasswort"])
{
# Userdaten korrekt - User ist eingeloggt
# Login merken !
$_SESSION["login"] = 1;
}
}
if ($_SESSION["login"] != 1)
{
echo "bitte einloggen";
exit;
}
# User ist eingeloggt
?>
<?php
// configuration
$url = 'index.php?catch=newscp';
$file = './news.txt';
// check if form has been submitted
if (isset($_POST['text']))
{
// save the text contents
file_put_contents($file, $_POST['text']);
// redirect to form again
@header(sprintf('Location: %s', $url));
printf('Die Änderungen wurden erfolgreich gespeichert.<br><a href="%s">Zurück zum Editor.</a>', htmlspecialchars($url));
exit();
}
// read the textfile
$text = file_get_contents($file);
?>
<center>
<div class="content_top">News bearbeiten</div>
<div class="content_bottom_grey">
<form action="" method="post">
<textarea name="text" cols="55" rows="44"><?php echo htmlspecialchars($text, ISO-8859-1) ?></textarea>
<br><input type="submit" value="Änderungen speichern"/>
</form>
</div>
</center>
|