I have a form on a site that is collecting user details. There was a fool submitting the form with a name like "Barneycok" from different IP addresses, so I learned how to block that name from going through on the form.
I learned a little regex, just enough to write this little piece:
if (preg_match('/\b(\w*arneycok)\b/', $FirstName)){
$error.= "<li><font face=arial><strong>Sorry, an error occured. Please try again later.</strong><br><br>";
$errors=1;
}
The code has worked perfectly and I never got that name coming through anymore. However, recently, someone is entering a string of numbers on the name field.
The string looks like this:
123456789
123498568
123477698
12346897w
If you notice, the first 4 characters are constant throughout.
So how do I add that in my regex above so that if the name starts with "1234", it will simply match that regex and give the user the error code?
Your help will be greatly appreciated.
Jaime