Dieser Code ist die minimal Voraussetzung eines Loginformulars:
Code:
<!-- HEADER EINBINDEN (WICHTIG) -->
<?php include('template/header.php'); ?>
<!-- FEHLERBEHANDLUNG -->
<?php if ($error): ?>
<?php if ($error == 1): ?> This combination of username and password is not valid
<?php elseif ($error == 2): ?> Du wurdest erfolgreich ausgeloggt - Du warst <?php echo $time; ?> Minute<?php if ($time != 1): ?>n<?php endif; ?> online - Es ist <?php echo $time_hi; ?> Uhr.
<?php elseif ($error == 3): ?> Logge dich ein, um diese Seite zu sehen
<?php endif; ?>
<?php endif; ?>
<!-- LOGIN-FORMULAR -->
<form action="login.php" method="post">
<table align="center" cellpadding="5" cellspacing="0">
<tr>
<td>Benutzername:</td>
<td><input size="25" type="text" name="username" /></td>
</tr>
<tr>
<td>Passwort:</td>
<td><input size="25" type="password" name="password" /></td>
</tr>
<tr>
<td></td>
<td><input type="checkbox" id="merke" name="merke" /> <label for="merke">An mich erinnern</label></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="button" value="Login" /><br /><br /><a href="password.php">Passwort vergessen?</a><br /><b><a href="register.php">Werde Mitglied !</a></b></td>
</tr>
</table>
<input type="hidden" name="redirect" value="<?php echo $redirect; ?>" />
</form>
<!-- FOOTER EINBINDEN (OPTIONAL) -->
<?php include('template/footer.php'); ?>
Zum Benutzen der Session etc. reicht diese Abfrage:
Code:
if (!$user->row['user_id'])
{
login_box();
}
Korrigiert mich, falls ich falsch liegen sollte.