Version: 1
Type: Full Script
Category: Algorithms
License: Other
Description: Check if the entered email address is valid or not.
<? function disp_header() { global $PHP_SELF; ?> <form method=post action=<?echo$PHP_SELF?>> <input type=hidden name=sub value="ok"> Enter Email address <br> <input type=text name=EMAIL size="20" value=<?echo$EMAIL?>> <input type=submit name=submit value=Check> </form> <? } if (empty($sub)) { disp_header(); } elseif ($sub == "ok") { $CHECK= strstr ($EMAIL, '@'); $CHECK1= strstr ($CHECK, '.'); list( $name, $host) = split( '[@]', $EMAIL ); list( $host1, $host2, $host3) = split( '[.]', $host); if ( ( ereg( "([~!#$%^&*])", $EMAIL)) || (!$CHECK) || ($CHECK == "@") || (!$CHECK1) || ( ereg( "([@])", $name)) || ($host1== "") ) { print "$EMAIL not valid Email Addressn"."<br>n"; } else { if ($name == "") { print "Entered email address <$EMAIL> is wrongn"; } else { Print "valid email address $EMAIL"; } } } ?>