Habe ein Login System programmiert allerdings funktioniert das einloggen nur dann wenn benutzername und Passwort gleich sind. Dies ist mir unklar. Vielleicht kann mir irgendwehr weiterhelfen. Dank
<?php require_once('../Connections/rkkilb.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['pass'])) {
$loginUsername=$_POST['nr'];
$password=$_POST['pass'];
$password = md5($password);
$MM_fldUserAuthorization = "Zugriff";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "login%20fehler.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_rkkilb, $rkkilb);
$LoginRS__query=sprintf("SELECT dienstnummer, Passwort, Zugriff FROM mitarbeiter WHERE dienstnummer='%s' AND Passwort='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $rkkilb) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'Zugriff');
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="200" border="1">
<tr>
<td width="150">Dienstnummer</td>
<td width="34"><input name="nr" type="text" id="nr"></td>
</tr>
<tr>
<td>Passwort</td>
<td><input name="pass" type="text" id="pass"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="Senden"></td>
</tr>
</table>
</form>
</body>
</html>
<?php require_once('../Connections/rkkilb.php'); ?>
<?php
// *** Validate request to login to this site.
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($_POST['pass'])) {
$loginUsername=$_POST['nr'];
$password=$_POST['pass'];
$password = md5($password);
$MM_fldUserAuthorization = "Zugriff";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "login%20fehler.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_rkkilb, $rkkilb);
$LoginRS__query=sprintf("SELECT dienstnummer, Passwort, Zugriff FROM mitarbeiter WHERE dienstnummer='%s' AND Passwort='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $rkkilb) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'Zugriff');
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="200" border="1">
<tr>
<td width="150">Dienstnummer</td>
<td width="34"><input name="nr" type="text" id="nr"></td>
</tr>
<tr>
<td>Passwort</td>
<td><input name="pass" type="text" id="pass"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="Senden"></td>
</tr>
</table>
</form>
</body>
</html>
Kommentar