validating url
Posted on
16th Feb 2014 07:03 pm by
admin
im trying to validate url's sent to me by a form
the url's im collecting are for placing banners on my site
so the url's are the link to there site and url of where there banner is
Did you know?Explore Trending and Topic pages for more stories like this.
URL's ARE BROKEN INTO PARTs PROTOCOL/SUBDOMAIN/DOMAIN NAME/DIRECTORY/FILE
SO FAR I GOT
Code: if(!preg_match("/^http://www.[a-z0-9-].[a-z]{2,3}[a-z0-9/.] $/i", $_POST[url]))
This checks the form feild url
1) make sure http://www. is present (i dont see why it should be any different for the purpose of my use)
i wll be placing a warning on my form page that the urls must contains this
2) Then my code checks it consists of only letters,numbers,dashes/hythens i read these are the only characters a domain name can be
also they must start with a letter or number so how do i make that possible?
3) the next part makes sure theres a .
4) the next part makes sure it consists of only letter of 2-3 characters long
this only alows things such as .com or .ru
How do i alow multiple for example .co.uk
5) i then want to make the rest optional but to alow
letter/numbers/for directories . for start of ext
can anyone help me tweak my code to satisfy my needs but to be as strict as possible.
also knowing what my code is going to be checking is there any genuine urls that the code would refuse
or is there anything i need to know
No comments posted yet
Your Answer:
Login to answer
304
20
Other forums
help with email script...
hey
I need help with my mail script
when the form on http://www.mcgdesignstudio.com/c
Reading Most Recent CSV File in Directory
I thought I had wrapped this project up, but found out that the program I use to FTP a csv file to m
How to search for several parameters from objects in a database?
I have a database with lots of information about objects.
Now I would like to search for 4 or 5 p
How to write on database when a link is clicked?
Hi,
I have a list of products in a gridview. When the link is clicked currently it takes to an ext
List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab
having probem inserting data into db table
hi
i have a table with following columns in it
Code: candidate_id, degree, cgpa, institute
Newb advice
Hi all,
I'm a flash front end designer and I've taken on a project that needs some back end p
Save User Inputs while javascript reloading!
hi..
i have written a PHP code in which i reload the page when user selects a value in dropdown..
Can't get the unicode character
I'm trying to get some text from various parts of a file. I have converted the file to hex (bin2hex)
mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???
this is the code i got