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
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
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
re calling a function without including file
Hi,
i am new to programming in php, i was just checking the wordpress code and found out in the w
Email "$"
Hello!!
Any PHP guy with a bit of a knowledge in Flash ?
When I send a JPEG from flash
Sorting JTable on more than just the values listed in the columns
I have a collection of objects that store (among other things) two integer values. I only want to di
i want run some web server under the ip sharer
hello i want run some web server under the ip sharer
my ip is floating ip but it doesnt matter
Getting number of affected rows in SQLPLUS..
Hi everyone,
I have a shell script where i am invoking sqlplus, running a query and saving t
How to replace search button with link?
hi to everbody.
i have a search submit form and button like this :
<form id="f
MYSQL gen help
This is my Mysql gen. can anyone tell me why this echos
MID(networkset.networkid, 3, 3) AS &q
ECC6 - Single sign-on
We are in the process of upgrading to ECC 6 which will support single sign on with user passwords al
modifying a property of an object from a different class
I have 2 classes:
- Math
- Distance
in my math class, I have this line:
$distance =