<?php
session_start() ;
include ("config.php");
include ("database.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><?php $title ?></title>
</head>
<body>
<form action="login.php" method="post">
<p>Benutzername:<br/>
<input name="username" type="text" maxlength="20"></p>
<p>Passwort:<br/>
<input name="passwort" type="password"></p>
<input name="submit" type="submit" value="Registrieren"></p>
</form>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
if(empty($_POST['username']) or empty($_POST['passwort']) )
{
echo '<script type="text/javascript">;alert("Bitte alle Felder ausfüllen!")</script>';
}
else
{
$username = $_POST['username'];
$passwort = $_POST['passwort'];
$mysqlgetuser = mysql_query("SELECT username, passwort FROM users WHERE username LIKE '$username' LIMIT 1") or
die(mysql_error());
$mysqlgetuserrow = mysql_fetch_object($mysqlgetuser) ;
if($mysqlgetuserrow->passwort == $passwort)
{
echo ('Erfolgreich eingeloggt '. $username . '<meta http-equiv="refresh" content="2;url='. $pfad .'index.php">');
$_SESSION['username'] = $username;
}
else
{
echo ("Falsche eingabe! <br /> Haben Sie Ihr <a href=" .$pfad ."passwortvergessen.php>Passwort vergessen?</a>");
}
}
}
?>