Hallo Leute,
ich habe mit PHP eine einfache Passwortabfrage erstellt. Leider wird anscheinend nur die 1. Zeile der Passwort-Datei ausgelesen.
Kann mir bitte jemand sagen, was ich falsch mache?
Quelltext der PHP Datei:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
@import url(../../css/css.css);
-->
</style>
<body bgcolor="#FFFFFF" text="#000000" background="../../images/back.gif" class="schrift" leftmargin="0" topmargin="0" style="scrollbar-arrow-color:#ffffff;scrollbar-base-color:#ffffff;scrollbar-track-color:#000066;scrollbar-darkshadow-color: #000066;scrollbar-3dlight-color: #000066;scrollbar-shadow-color: #ffffff;scrollbar-highlight-color: #ffffff" oncontextmenu="return false">
<?php
if (($HTTP_POST_VARS['username'] !=="") && ($HTTP_POST_VARS['passwort']!=="")) {
$filename = "pass.xtx";
$fp = fopen($filename, "r");
$file_contents = fread($fp, filesize($filename));
fclose($fp);
// Place each line in user info file into an array
$line = explode(";", $file_contents);
// For as long as $i is <= the size of the $line array,
// explode each array element into a username and password pair
$i = 0;
while($i <= sizeof($line)) {
$data_pair = explode(",", $line[$i]);
if (($data_pair[0] == $HTTP_POST_VARS['username']) && ($data_pair[1] == $HTTP_POST_VARS['passwort'])) {
$auth = 1;
$link = $data_pair[2];
break;
} else {
$auth = 0;
}
$i++;
}
if ($auth =="1") {
echo '<p> </p><p> </p><h1 align="center">Klicken Sie hier, um das Programm zu starten.</h1>';
echo '<p align="center"><a href="'.$link.'">Eurofinanz Berechnungsprogramm</a></p>';
echo '</body></html>';
exit;
}else {
echo '<p> </p><p> </p><h2 style="font-weight: bold; color: red" align="center">Der Benutzername oder das Passwort sind nicht korrekt!</h2>';
echo '<p align="center"><a href="../jump.php?url=login/">Zurück</a><p>';
echo '</body></html>';
}
} else {
echo '<p> </p><p> </p><h2 style="font-weight: bold; color: red" align="center">Sie müssen Benutzernamen und Passwort angeben!</h2>';
echo '<p align="center"><a href="../jump.php?url=login/">Zurück</a><p>';
echo '</body></html>';
}
?>
Quelltext der pass.xtx
admin3,test3,http://www.eurofinanz.co.at/vertriebspartner/jump.php?url=ortnerreinhard/;
admin2,test2,http://www.eurofinanz.co.at/vertriebspartner/jump.php?url=admin1/;
admin3,test3,http://www.eurofinanz.co.at/vertriebspartner/jump.php?url=ortnerreinhard/;
dornauerudo,udoeuro,http://www.eurofinanz.co.at/vertriebspartner/jump.php?url=dornauerudo/;
Ich finde den Fehler nicht.
Vielen Dank für eure Mühe.
Gruss
Rene