note 17393 added to function.substr-count

From: Date: Thu, 06 Dec 2001 20:18:26 +0000
Subject: note 17393 added to function.substr-count
Groups: php.notes 
Request: Send a blank email to php-notes+get-21720@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!"); } -- http://www.php.net/manual/en/function.substr-count.php http://master.php.net/manage/user-notes.php?action=edit+17393 http://master.php.net/manage/user-notes.php?action=delete+17393 http://master.php.net/manage/user-notes.php?action=reject+17393

« previous php.notes (#21720) next »