PHP, Reading Text File For String -
i trying read text file , find out if there string in there. have tried many different ways. have far,
$file = "./userpass.txt"; $loginuser = $_post[loginuser]; $loginpass = $_post[loginpass]; $fileauth = file_get_contents($file); if (strpos($file,$loginuser) !== false , strpos($file,$loginpass) !== false) { echo 'incorrect password'; } else { echo 'hello master'; }
change
$loginuser = $_post[loginuser]; $loginpass = $_post[loginpass];
to
$loginuser = $_post['loginuser']; $loginpass = $_post['loginpass'];
and code reads file contents
$filename = "newfile_testing.txt"; $file_handle= fopen($filename , "r"); $thedata = fread($file_handle, filesize($filename)); print_r($thedata);
php string
No comments:
Post a Comment