PHP ?? - ?? ??? ? URL
PHP - ?? ??
?? ??? ?? ??? ??? ??? ???? ??? ??? ??? ???? ?????. ?? ?? ?? ??? ?? ?? ???? ?????.
$name = test_input($_POST["name"]);
if (!preg_match("/^[a-zA-Z ]*$/" ,$name) )
{
$nameErr = "??? ??? ?????."
}
preg_match — ??? ??? ?????.
??:
int preg_match ( string $pattern , string $subject [, array $matches [, int $flags ]] )
?? ????? ???? ??? ???? ???? ???? ?????. ???? ??? ???? ?? ??? ?????. $matches[0]?? ?? ??? ???? ???? ????, $matches[1]?? ?? ?? ? ?? ??? ?? ??? ???? ???? ?????.
?? ???? ?? ??? ??? ??? ?????. ?? ??? - ????
PHP - ?? ???
?? ??? ??? ??? ????? ??? ???? ?????. ??? ??? ??? ?? ??? ?? ?? ???? ?????:
$email = test_input($_POST["email"]);
if (!preg_match("/([w-]+@[w-]+.[w-]+)/",$email))
{
$emailErr = "??? ??? ??";
} - URL ??
?? ??? URL ??? ???? ?????(?? ?? ??? ?? URL?? ??: "-"? ???? ??). URL ??? ??? ?? ?? ???? ?????.
$website = test_input($_POST["website"]);
if (!preg_match("/b(?:( ?:https?|ftp)://| www.)[-a-z0-9+&@#/%?=~_|!:,.;]*[-a-z0-9+&@# /%=~_|]/i", $website))
{
$websiteErr = " ?? URL ??";}
PHP - ??, ???, URL ??
??? ??? ????.????
????