Thomy: Loginsystem funktioniert nicht

Beitrag lesen

Hi,
nun geht grad gar nichts mehr, ich klicke auf Abschicken, aber es lädt immer wieder das Forumlar.
Mein adminquelltext:
<?php
    if(isset($_GET['action']) AND ("logout" == $_GET['action'])) {
        session_destroy();
        echo "<p><font color="white">\n";
        echo "    Sie haben sich ausgeloggt. Um wieder in den Adminbereich\n";
        echo "    zu kommen müssen sie sich wieder Einloggen\n";
        echo "</p></font>\n";
    } else {
        if(isset($_POST['UserID']) AND '0' == $_POST['UserID']) {
            echo "<p><font color="white">\n";
            echo "    Bitte wählen sie einen Benutzernamen aus.\n";
            echo "</p></font>\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><font color="white">\n";
                echo "    Willkommen im Adminbereich <br />\n";
                echo "    <a href="index.php?section=admin&amp;".SID."">Repeat</a>\n";
                echo "    <a href="index.php?section=admin&amp;action=logout&amp;".SID."">Ausloggen</a>\n";
                echo "</p></font>\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="default.php?section=admin" method="post" class="admin_form">\n";
                echo "    <table>\n";
                echo "        <tr>\n";
                echo "            <th colspan="2">\n";
                echo "                <h2><font color="white">Adminbereich</h2>\n";
                echo "            </th>\n";
                echo "        </tr>\n";
                echo "        <tr>\n";
                echo "            <td>\n";
                echo "                <label for="name"><font color="white">Name:</font></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"><font color="white">Password:</font></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";
            }
        }
    }
?>

function quelltext(ausschnitt):
...
function login_right($id, $pass)
{
$sql = "SELECT
   COUNT(*) as Anzahl
  FROM
   users
   WHERE
   ID = '".$id."' AND
    Password = MD5('".$pass."');";
   $result = mysql_query($sql) OR die(mysql_error());
   $row = mysql_fetch_assoc($result);
   mysql_free_result($result);
   return $row['Anzahl'];
}
...

Ich hoff ihr findet den Fehler.

#Thomy