can someone check this for me

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chris_s_22
Forum Commoner
Posts: 76
Joined: Wed Dec 31, 2008 2:05 pm

can someone check this for me

Post by chris_s_22 »

both of these are suposed to check url is in correct format?

this should only alow http:// with domain name
with no folder extentions

Code: Select all

if(!preg_match("/^http://[0-9a-zA-Z-.].[a-zA-Z]{2,3}$/", $_POST[linkto]))
this should alow as above but with folder ext

Code: Select all

if(!preg_match("/^http://(www.[0-9a-zA-Z][0-9a-zA-Z-][0-9a-zA-Z]|[0-9a-zA-Z][0-9a-zA-Z-][0-9a-zA-Z]).[a-zA-Z]{2,3}[0-9a-zA-Z/-_.]$/", $_POST[linkfrom]))
Post Reply