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. Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.