PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Passwort


dAsDraKe
18.11.2001, 18:28
Hi there :D
Ich habe mal eine frage zu einem Logineingang.
ich habe jetzt erstmal die erste seite mit allen loginnahmen kein problem und das passwortfeld
das problem kommt bei der login2.php.
Wenn ich nämlich alles eingebe und dann ok drücke kommt error line so und so. So sieht mein Code aus bei login2.php.. vielleicht könnt ihr mich auf den fehler aufmerksam machen:
<?
if($user == &quot;toXic&quot; and $passwort == &quot;ab&quot;)
{
echo &quot;Login successful - Hi toXic&quot;;
}
else
{
echo &quot;Login failed - retry!&quot;;
}
elseif($user == &quot;drake&quot; and $password == &quot;12&quot;)
{
echo &quot;Login successful - Hi drake&quot;;
}
else
{
echo &quot;Login failed - retry&quot;;
}
?>

PS: Bei 1. Person funktioniert es aber bei person 2 nicht mehr. Woran kann das liegen? (Sorry bin PHPn00b)


pate33
18.11.2001, 18:54
der code kann aus prinzip nicht funktionieren... du schreibst: (klartext - logische abfolge)

wenn der user gleich toxic ist, dann login
ansonsten kein login

die elseif anweisung wird dabei uebergangen...

versuch mal:


<?
if($user == &quot;toXic&quot; and $passwort == &quot;ab&quot;)
{
echo &quot;Login successful - Hi toXic&quot;;
}
else
{
elseif($user == &quot;drake&quot; and $password == &quot;12&quot;)
{
echo &quot;Login successful - Hi drake&quot;;
}
else
{
echo &quot;Login failed - retry&quot;;
}
?>

cYrus
18.11.2001, 19:43
Ich würds aber so machen ist übersichtlicher, finde ich, und geht einfacher zum überarbeiten

so long
Dj-Cyrus


<?
if($user == &quot;toXic&quot; and $passwort == &quot;ab&quot;)
{
echo &quot;Login successful - Hi toXic&quot;;
}

elseif($user == &quot;drake&quot; and $password == &quot;12&quot;)
{
echo &quot;Login successful - Hi drake&quot;;
}

else
{
echo &quot;Login failed - retry&quot;;
}
?>

sami
18.11.2001, 20:17
wenn wir schon am optimieren sind:

<?
if($user == &quot;toXic&quot; and $passwort == &quot;ab&quot;) or ($user == &quot;drake&quot; and $password == &quot;12&quot;)
{
echo &quot;Login successful - Hi &quot; . $user;
}
else
{
echo &quot;Login failed - retry&quot;;
}
?>

pate33
19.11.2001, 08:49
@dAsDraKe

wie du siehst gibt es verschiedene moeglichkeiten, dein problem zu loesen, jedoch empfehle ich dir auf jeden fall, das board an ne datenbank zu koppeln. damit du spaeter die moeglichkeit hast, noch mehr benutzer zuzulassen... (wenn du das nicht bereits getan hast, mit der datenbank)

greetz