note 17393 deleted from function.substr-count by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 21:59:43 +0000 |
| Subject: | note 17393 deleted from function.substr-count by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23460@lists.php.net to get a copy of this message | ||
A simplified way to verify an email address, image URL or domain submitted by a user:
// check for valid email address
$checkemailat=substr_count($email,"@");
$checkemaildot=substr_count($email,".");
if($checkemailat!=1){
print("invalid email address - no '@'!");
}
if($checkemaildot==0){
print("invalid email address - no 'dot'!");
}
(this would make my email address invalid because I used two "@"s to avoid spammers.)
// for a domain or image URL (with modification) - say you request that the user enters the full
domain "www.yourdomain.com", for example)
$checkwebsiteurl=substr_count($website,".");
if($checkwebsiteurl<2){
print("invalid URL!");
}