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:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
|
<?php
if(isset($_GET['action']) AND ("logout" == $_GET['action'])) {
session_destroy();
echo "<p>\n";
echo " Sie haben sich ausgeloggt. Um wieder in den Adminbereich\n";
echo " zu kommen müssen sie sich wieder Einloggen\n";
echo "</p>\n";
} else {
if(isset($_POST['UserID']) AND '0' == $_POST['UserID']) {
echo "<p>\n";
echo " Bitte wählen sie einen Benutzernamen aus.\n";
echo "</p>\n";
} else {
if(isset($_POST['UserID'], $_POST['Password']) AND
login_right(addslashes($_POST['UserID']),
addslashes($_POST['Password']))) {
$_SESSION['ID'] = $_POST['UserID'];
}
if(isset($_SESSION['ID'])) {
echo "<p>\n";
echo " Willkommen im Adminbereich <br />\n";
echo " <a href="index.php?section=admin&".SID."">Repeat</a>\n";
echo " <a href="index.php?section=admin&action=logout&".SID."">Ausloggen</a>\n";
echo "</p>\n";
} else {
if(isset($_POST['submit'])) {
// Der Submit-Button wurde gedrückt
// aber der Login ist falsch. Deshalb
// erstellen wir eine Fehlermeldung
echo "<p class="error">\n";
echo " Ungültiges Password.\n";
echo "</p>\n";
}
echo "<form action="index.php?section=admin" method="post" class="admin_form">\n";
echo " <table>\n";
echo " <tr>\n";
echo " <th colspan="2">\n";
echo " <h2>Adminbereich</h2>\n";
echo " </th>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>\n";
echo " <label for="name">Name:</label>\n";
echo " </td>\n";
echo " <td>\n";
$sql = "SELECT
`ID`,
`Name`
FROM
`users`
ORDER BY
`Name` ASC;";
$result = mysql_query($sql) OR die(mysql_error());
echo " <select size="1" name="UserID" id="name">\n";
echo " <option value="0" selected="selected">Bitte wählen</option>\n";
while($row = mysql_fetch_assoc($result)) {
echo "<option value="".$row['ID']."">".$row['Name']."</option>\n";
}
echo " </select>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>\n";
echo " <label for="password">Password:</label>\n";
echo " </td>\n";
echo " <td>\n";
echo " <input type="password" name="Password" id="password"/>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td colspan="2">\n";
echo " <input type="submit" name="submit" value="Abschicken" />\n";
echo " <input type="reset" name="submit" value="Zurücksetzen" />\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</form>\n";
}
}
}
?>
|