Eingenes Login-Script - Problem

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Eingenes Login-Script - Problem

    Hallo,
    ich bin ein PHP-Newbie . Deswegen will ich (um es zu lernen bzw. anzuwenden) ein eigenes Login Script schreiben.
    Dieses sieht bisher so aus:
    PHP-Code:
    <html>
    <head>
    <title>Admin Interface - Login</title>
    <style type=text/css>
    td, input, body {font-family: Verdana; font-size: 12px;}
    </style>
    </head>
    <body bgcolor=#ABBF73>
    <form action=adminlogin.php method=post>
    <?php
    mysql_connect
    ("....");
    mysql_select_db("....");
    $name_abfrage "select name from `mordred_login` where id like 1";
    $pw_abfrage "select pw from `mordred_login` where id like 1";

    if (
    $name == mysql_query($name_abfrage)) {
        if (
    $pw == mysql_query($pw_abfrage)) {
            echo 
    "Sie wurden erfolgreich eingeloggt!<br>";
            echo 
    "<a href=admininterface.htm>Zum Admin Interface</a>";
                                }
        else {
            echo
    "
                <table width=100% height=100%><tr><td width=100% height=100% valign=center>
                <table align=center border=0 bgcolor=#45602A width=215 cellspacing=2 cellpadding=0><tr><td><center><b>Admin Interface - Login</b></td></tr></table>
                <table align=center border=0 bgcolor=#6D9742 width=200 cellspacing=2 cellpadding=0>

                <tr><td align=right>Name:    </td><td><input type=text name=name size=20 value=
    $name>    </td></tr>
                <tr><td align=right>Passwort:    </td><td><input type=password name=pw size=20 value=
    $pw>    </td></tr>

                <tr><td colspan=2 align=right><input type=submit value=Einloggen></td></tr>
                </table>
                <table align=center border=0 cellspacing=2 cellpadding=0><tr><td><center>Ihre Angaben sind nicht korrekt!</td></tr></table>
                </td></tr>
                </table>
                "
    ;
            }
                                }

    else {
        echo
    "
                <table width=100% height=100%><tr><td width=100% height=100% valign=center>
                <table align=center border=0 bgcolor=#45602A width=215 cellspacing=2 cellpadding=0><tr><td><center><b>Admin Interface - Login</b></td></tr></table>
                <table align=center border=0 bgcolor=#6D9742 width=200 cellspacing=2 cellpadding=0>

                <tr><td align=right>Name:    </td><td><input type=text name=name size=20 value=
    $name>    </td></tr>
                <tr><td align=right>Passwort:    </td><td><input type=password name=pw size=20 value=
    $pw>    </td></tr>

                <tr><td colspan=2 align=right><input type=submit value=Einloggen></td></tr>
                </table>
                <table align=center border=0 cellspacing=2 cellpadding=0><tr><td><center>Ihre Angaben sind nicht korrekt!</td></tr></table>
                </td></tr>
                </table>
            "
    ;
        }
    ?>
    </form>
    </body>
    </html>
    Das Problem:
    Ich kann, egal ob richtiges oder falsches, mich nicht einloggen.

    Meine Frage:
    Weiß jemand wo der Fehler liegt?


    mfg Mordred

    (P.S.: Ich will keinen Antworten wie: Was willsten damit? oder Was soll das...nimm einfach ein fertiges. )

  • #2
    Ich habs endlich geschafft

    Vorher:
    PHP-Code:
    <?php
    mysql_connect
    ("....");
    mysql_select_db("....");
    $name_abfrage "select name from `mordred_login` where id like 1";
    $pw_abfrage "select pw from `mordred_login` where id like 1";

    if (
    $name == mysql_query($name_abfrage)) {
        if (
    $pw == mysql_query($pw_abfrage)) {
    Nacher:
    PHP-Code:
    <?php
    mysql_connect
    ("....");
    mysql_select_db("....");
    $abfrage 'select id,name,pw from mordred_login where id=1';
    $abfrage1 mysql_query($abfrage);
    $row mysql_fetch_array($abfrage1);
    if (
    $name == $row[name]) {
        if (
    $pw == $row[pw]) {
    plz close

    Kommentar

    Lädt...
    X