Also hier:
PHP-Code:
<?php
// database connect script.
require 'db_connect.php';
if($logged_in == 1) {
die('<center><font face="verdana">Sie sind bereits eingeloggt als '.$_SESSION['A_USER'].'.</font></center>');
}
?>
<html>
<head>
<title>Login</title>
</head>
<body>
<?php
if (isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they were supposed to and authenticate */
if(!$_POST['uname'] | !$_POST['passwd']) {
die('<center><font face="verdana">Bitte füllen Sie alle Felder aus.</font></center>');
}
if (!get_magic_quotes_gpc()) {
$_POST['uname'] = addslashes($_POST['uname']);
}
$check = $db_object->Execute("SELECT T_USERS.A_USER, T_USERS.A_PASSWORT FROM T_USERS WHERE T_USERS.A_USER = '".$_POST['uname']."'");
if ($check->numRows() == 0) {
die('<center><font face="verdana">Dieser User existiert leider nicht in der Datenbank.</font></center>');
}
$info = $check->FetchRow();
$_POST['passwd'] = stripslashes($_POST['passwd']);
$info['A_PASSWORT'] = stripslashes($info['A_PASSWORT']);
// $_POST['passwd'] = md5($_POST['passwd']);
if ($_POST['passwd'] != $info['A_PASSWORT']) {
die('<center><font face="verdana">Falsches Passwort, bitte geben Sie Ihr Passwort erneut ein.</font></center>');
}
$date = date('Y-m-d');
$update_login = $db_object->Execute("UPDATE T_USERS SET T_USERS.A_WEBLOG = '$date' WHERE T_USERS.A_USER = '".$_POST['uname']."'");
$_POST['uname'] = stripslashes($_POST['uname']);
$_SESSION['A_USER'] = $_POST['uname'];
$_SESSION['A_PASSWORT'] = $_POST['passwd'];
$db_object->disconnect();
?>
<h1>Erfolgreich eingeloggt !</h1>
<p>Willkommen <?php echo $_SESSION['A_USER']; ?>, Sie sind nun eingeloggt.</p>
<?php
} else { // if form hasn't been submitted
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table align="center" border="0" cellspacing="0" cellpadding="3">
<tr><td><font face="verdana"><b>Username:</b></font></td><td>
<input type="text" name="uname" maxlength="40">
</td></tr>
<tr><td><font face="verdana"><b>Passwort:</b></font></td><td>
<input type="password" name="passwd" maxlength="50">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Login">
</td></tr>
</table>
</form>
<?php
}
?>
</body>
</html>
Kommentar