checking for repeated letters is easy. this page will show you how to check for repeated characters in your web forms when a user hits submit button and you validate the information they sent is repeated, if you see repeated chracters sometimes its spam [1056], Last Updated: Sat May 18, 2024
wallpaperama
Thu Jul 12, 2007
3 Comments
1546 Visits
if you're a webmaster, often you will have forms on your websites asking user's input. they send the form to you and when you receive the information you find bogus information for example the same letter over and over and you wish you can stop it, i have a form where i ask for visitor's opinions and these are the fields on the form:
Name:
Comments:
when someone send the form, i often see information like this submitted: (example)
Name: zzzzzzzzzzzzz
comments: PHP is so cool. i love PHP
well this was very annoying, as you can see the name is abviously not correct. one way to check for a valid's user's name is with PHP.
I wrote this script so you can see how it works. this snippet shows you how you can block bogus information submitted by users in your forms, like repeated characters or letter or numbers
<img src="http://webune.com/images/headers/default_logo.jpg">
<h1>Checking for repeated letters by webune.com</h1><hr>
<?
if(isset($_REQUEST['Submit']))
{
# FORM HAS BEEN SUMBITTED
}
else
{
# FORM HAS NOT BEEN SUBMITTED
?>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
Name: <input type="text" name="name">
<input type="submit" name="Submit" value="Submit">
</form>
<?
}
?>
<hr>
<div align="center">PHP Webhosting at <a href="http://www.webune.com">www.webune.com</a></div>
to see the script in action, all you have to do is copy and paste it to your text editor like notepad is you are using windows. once you have paste the code into notepad, save the file as wallpaperama.php then upload to your website. make sure your website has PHP. when you see the script you will see a form asking for information if you enter a name like zzzzzzzz for example the form will error out. this form is good for checking repeating charracters in a string
if your wesbite doesn't have PHP, you can visit www.webune.com and sign up for PHP web hosting. their plans are cheap(affordable) web hosting.
zzzzzzzzzzzzz
Tue Apr 13, 2010
PHP is so cool. i love PHP!!! PHP is so cool. i love PHP!!! PHP is so cool. i love PHP!!! PHP is so cool. i love PHP!!!