Millar Posted March 18, 2006 Share Posted March 18, 2006 Well, I was wondering if anyone could give me a script I can use to get a entered value from a post form (e.g Username) and check to see if the username exists in a plain txt file I have with usernames separated by a line break, thanks in advanced.Millar. Link to comment https://forums.phpfreaks.com/topic/5239-php-help/ Share on other sites More sharing options...
hitman6003 Posted March 18, 2006 Share Posted March 18, 2006 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.