I have the user.txt file with a user in it already. the username is Admin and password is 123. What I want to do is that if these two were somewhere in the middle of the file it could be found and compared that both were correct so that the flag would equal 1.
this is the code I have so far.
<?php
session_start();
$_SESSION[name] = $_POST[name];
$_SESSION[pass] = $_POST[pass];
$flag= 0;
if(!$fp = fopen("users.txt","r")) {
echo "Error 404";
}
else {
while(!feof($fp)){
$line1= fgets($fp,10);
$line2= fgets($fp,10);
if($line1== $name && $line2 == $pass)
$ban = 1;
}
fclose($fp);
}
if($flag == 1){
?>
<html>
<head>
<meta http-equiv="refresh" content="3; url= access.php">
</head>
</html>
<?php
}
else{
?>
<html>
<head>
<meta http-equiv="refresh" content="3; url= login.html">
</head>
</html>
<?php
}
?>