Verfasst: 03.07.2003 01:25
Welchen PHP Code nutzt du denn jetzt genau?
Wie sieht dein Loginformular jetzt aus?
Wie sieht dein Loginformular jetzt aus?
Code: Alles auswählen
]<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="login_check.php">
<p>Benutzername:</p>
<p>
<input type="text" name="usernmae">
</p>
<p>Passwort</p>
<p>
<input type="password" name="userpwd">
</p>
<p>
<input type="submit" name="Submit" value="Login">
</p>
</form>
</body>
</html>
Code: Alles auswählen
<?php
$username = $_POST["username"];
$userpwd = $_POST["userpwd"];
$benutzername = admin;
$passwort = admin; ?>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
if ($username == $benutzername) {
if ($userpwd == $passwort) {
echo "<a href=\"/forum/\">Zum Forum ...</a>";
}
}
if ($username == "") {
if ($userpwd == "") {
echo header("location: http://localhost/index.php");
exit();
}
} ?>
</body>
</html>
Asserdem heißt das Feld im Formular "usernmae"...Mister_X hat geschrieben:Damit die header("location:xxx"); Anweisung funktioniert darf KEIN Text vorher ausgegeben werden deshalb muss das <html> usw. in die if-Schleife mit rein.Code: Alles auswählen
<?php $username = $_POST["username"]; $userpwd = $_POST["userpwd"]; $benutzername = 'admin'; $passwort = 'admin'; if ($username == $benutzername AND $userpwd == $passwort) { ?> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <a href="/forum/">Zum Forum ...</a> </body> </html> <?php } else { header("location: http://localhost/index.php"); exit(); } ?>