| |
|
|
Error: ' ;
// Read the entire file into the variable $file_contents
$fp = fopen( $pw, 'r' );
$file_contents = fread( $fp, filesize( $pw ) );
fclose( $fp );
// Place the individual lines from the file contents into an array.
$lines = explode ( "\n", $file_contents );
// Split each of the lines into a username and a password pair
// and attempt to match them to $n and $m.
foreach ( $lines as $line ) {
list( $username, $password ) = explode( ':', trim($line) );
if ( $username == "$n" ) {
// Get the salt from $password. It is always the first
// two characters of a DES-encrypted string.
$salt = substr( $password , 0 , 2 );
// Encrypt $m based on $salt
$enc_pw = crypt( $m, $salt );
if ( "$password" == "$enc_pw" ) {
// A match is found, meaning the user is authenticated.
// Stop the search.
$auth = true;
break;
}
}
}
}
if ( $auth ) {
if (file_exists($fl)) {
virtual($fl) ;
} else {
// virtual("kunden_html/index.html") ;
}
} else {
?>
Customers Entry
Please enter Your name and password.
|