<?php
$allowed_langs = array ('en','de');
$lang = lang_getfrombrowser ($allowed_langs,'en',null,false);
if (lang == 'de')
{
$greetingtext = "Melden sie sich bitte an";
$errormessage = "Fehler: Benutzername oder Passwort ist leer";
$loginname = "Benutzername";
$password = "Passwort";
$login_button = "Login";
$reset_button = "Reset";
}
else
{
$greetingtext = "Please log in";
$errormessage = "Fehler: Username or Password is empty";
$loginname = "Username";
$password = "Password";
$login_button = "Login";
$reset_button = "Reset";
}
?>
<html>
<head>
<title>loginformular</title>
</head>
<script language="JavaScript">
function check_form(msg)
{
var uname = document.forms['login'].username.value;
var upass = document.forms['login'].password.value;
while (uname.charat(0) == '')
{
uname = uname.substr(1);
}
document.forms['login'].username.value = uname;
if (uname.length > 0 && upas.length > 0)
{
return true;
}
else
{
alert (msg);
return false;
}
}
function sendform(msg)
{
if (checkform(msg))
{
document.forms['login'].submit();
}
}
function resetform()
{
document.forms['login'].reset()
}
</script>
<body>
<center>
<form name="login" method="POST" action="login.php" onsubmit="return checkform('<?php echo $errormessage; ?>');">
<table>
<tr>
<td colspan="3">
<?php echo $greetingtext ?>
</td>
</tr>
<tr>
<td>
<?php echo $loginname ?>
</td>
<td width="20">
</td>
<td>
<input> type="text" name="username" size="20" />
</td>
</tr>
<tr>
<td colspan="3" height="10">
</td>
</tr>
<tr>
<td>
<?php echo $password ?>
</td>
<td width="20">
</td>
<td>
<input> type="password" name="password" size="20" onkeypress=
"javascript:
if(document.all)
{
if(window.event.keycode==13
{
sendform('<?php echo $errermessage; ?>');
}
}
"
/>
</td>
</tr>
<tr>
<td colspan="3" height="10">
</td>
</tr>
<tr>
<td colspan="2">
</td>
<td align="right">
<a href="javascript:resetform();">
<?php echo $reset_button; ?>
</a>
<a href="javascript:sendform('<?php echo $errormessage; ?>');">
<?php echo login_button; ?>
</a>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>