Good Afternoon All,
Been a bit since I had a question... Guess my education from Daniweb is paying off...;-))
I have a form where a member is posting a banner URL and alt text to display a banner on our site.
I would like to validate the URL they enter as being formatted correctly.
I don't want them to enter the http:// because I will prepend that in the link display.
this is what I have...
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$clean_banner_link)){
$link_error = 'Link URL is NOT in a valid Format!';
$disp_mess = 'Please Correct Highlighted fields!';
}
But this allows the entry of http https ftp
OR requires that it begin with a www.
in the case where someone has a URL that is a sub-domain, they would be using that sub-domain handle as opposed to the www
So, the question is... How can I Refuse anything:// and at the same time allow either the www. or sub-domain. and validate the balance of the input?
OR even not require anything in that space, so they could enter SITEURL.com and have it accepted because when I prepend the http:// it will be http://SITEURL.com
Is it possible to format the validation to do all of this at once?
Thanks in advance.
Douglas