everything is correct to check if the username was exists in text file but when I type wrong username (another user beside in notepad) it’s just show me blank page cause I didn’t know what code should i type in there
@leelong; You need to [fphp]preg_quote[/fphp] that, otherwise it won’t work with certain characters in a username (e.g. a forward slash). Also, why do you prefer this over in_array? In general in_array is a faster than using a regular expressions.
Normally we don’t allow those special characters in username, so not quite an issue.
Looking at the first post, this thread is about learning PHP rather than “I get paid” for this project so help me, after all who on earth will use notepad based login system?
Of course, in_array will be the choice. IMHO, providing other approach will be beneficial for learning purpose, nothing else.