Jump to content

PHP Help


Millar

Recommended Posts

This should work, assuming that each line is only the username.

[code]$filename = "path/to/file.txt";
$username = $_POST['username'];

$file = file($filename);
if (in_array($username, $file)) {
  ...code for when the username is in the file...
} else {
  ...code for when the username is not in the file...
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/5239-php-help/#findComment-18645
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.