Thread View: de.comp.lang.php
5 messages
5 total messages
Started by Jose Luis Rodr�guez Sevilla
Fri, 30 Jun 2000 00:00
Validate Domain Name
Author: Jose Luis Rodr�guez Sevilla
Date: Fri, 30 Jun 2000 00:00
Date: Fri, 30 Jun 2000 00:00
18 lines
1218 bytes
1218 bytes
How i can to validate a domain name that only must contain this characters
"abcdefghijkmnpqrstuvwxyz2345678910ABCDEFGHIJKLMNOPQRSTUVWXYZ.-" ?
I tried this but it doesn't work.
if
(ereg('[^abcdefghijkmnpqrstuvwxyz2345678910ABCDEFGHIJKLMNOPQRSTUVWXYZ.-]',
$domain)){
$ok = "False";
}
if (eregi('[^-.a-z0-9A-Z]', $domain)){
$ok = "False";
}
Help me, please.
Thank You. Jose Luis
Re: Validate Domain Name
Author: Jose Luis Rodr�guez Sevilla
Date: Fri, 30 Jun 2000 00:00
Date: Fri, 30 Jun 2000 00:00
33 lines
1533 bytes
1533 bytes
Hello Again.
If you know how can i do it, please, tell me a part of code of your
solution.
Thank You.
Jose Luis
"Jose Luis Rodr�guez Sevilla" <joseluis@REMOVEMEferca.com> escribi� en el
mensaje news:8jhse0$p0o$1@talia.mad.ttd.net...
> How i can to validate a domain name that only must contain this characters
> "abcdefghijkmnpqrstuvwxyz2345678910ABCDEFGHIJKLMNOPQRSTUVWXYZ.-" ?
>
> I tried this but it doesn't work.
>
> if
> (ereg('[^abcdefghijkmnpqrstuvwxyz2345678910ABCDEFGHIJKLMNOPQRSTUVWXYZ.-]',
> $domain)){
> $ok = "False";
> }
>
> if (eregi('[^-.a-z0-9A-Z]', $domain)){
> $ok = "False";
> }
>
> Help me, please.
>
> Thank You. Jose Luis
>
>
>
>
Re: Validate Domain Name
Author: Darren Casey
Date: Sat, 01 Jul 2000 00:00
Date: Sat, 01 Jul 2000 00:00
53 lines
3244 bytes
3244 bytes
On Fri, 30 Jun 2000 13:23:37 +0200, "Jose Luis Rodr�guez Sevilla" <joseluis@REMOVEMEferca.com>
wrote:
>> How i can to validate a domain name that only must contain this characters
$bad_letters=array(
"!","\"","�","$","%","^","&","*","(",")","+","=","�",
"`","|","\\",".",",","<",">","?","/","{","}","[","]",
":",";","@","'","~","#"," ","�","�"
);
$min_allowed_len=3;
$max_allowed_len=60;
//----------------------------------------------------------------------------------------------
//Function to check a valid domain name has been entered
//I.E. Under s certain length
//No bad chars
//Note does not do a whois lookup
//Returns BLANK = Empty, TOLARGE, TOSMALL, BADLETTERS, OK
//----------------------------------------------------------------------------------------------
function checkdomain($domainname)
{
//Define Variable for use in this function
global $bad_letters;
global $max_allowed_len;
global $min_allowed_len;
// if $domainname is blank perform the following
if ($domainname=="")
return 'BLANK';
//Check to see if the domain name is to long
if (strlen($domainname)>$max_allowed_len)
return 'TOLARGE';
//Check to see if the domain name is to short
if (strlen($domainname)<$min_allowed_len)
return 'TOSMALL';
//search the $domainname for any of the bad letters
for($i=0; $i<count($bad_letters); $i++)
// strstr = find (haystack, needle)
if (strstr($domainname,$bad_letters[$i]))
//if it contains bad letters then return with the value bad letters
return 'BADLETTERS';
//if not and is ok then return with OK
return 'OK';
}
--
HTTP://WWW.PHP3HOSTING.COM ($) HTTP://WWW.PHP3HOSTING.CO.UK (�)
Website Hosting from $4.80/�3pm -- .COM/.NET $39.98/�24.99 - Search Engine Submission $4.78/�2.99
PHP3/4, Your own MySQL server, Full CGI capabilities, Shell Access, FTP, POP3, WAP
Support Forums - http://www.php3hosting.com/forum/
Re: Validate Domain Name
Author: brez
Date: Sun, 02 Jul 2000 00:00
Date: Sun, 02 Jul 2000 00:00
34 lines
1702 bytes
1702 bytes
I looks to me that you're only checking a single char. you need the '+' sign
in other words for multiple chars:
matches patterns with any number of these characters:
[a-zA-Z0-9\.\-]+
matches everything but those charaters:
[^a-zA-Z0-9\.\-]+
also you need to use the escape character with periods and dashes (i.e
'\.')
>How i can to validate a domain name that only must contain this characters
>"abcdefghijkmnpqrstuvwxyz2345678910ABCDEFGHIJKLMNOPQRSTUVWXYZ.-" ?
>
>I tried this but it doesn't work.
>
> if
>(ereg('[^abcdefghijkmnpqrstuvwxyz2345678910ABCDEFGHIJKLMNOPQRSTUVWXYZ.-]',
>$domain)){
> $ok = "False";
> }
>
> if (eregi('[^-.a-z0-9A-Z]', $domain)){
> $ok = "False";
> }
>
>Help me, please.
>
>Thank You. Jose Luis
>
>
>
>
Re: Validate Domain Name
Author: Ir. Marc W.F. Meurrens
Date: Tue, 04 Jul 2000 00:00
Date: Tue, 04 Jul 2000 00:00
30 lines
1954 bytes
1954 bytes
[FRANCAIS] Comment valider un nom de domaine? See the source code available at: Voyez le code source disponible �: Mira los ejemplos a l'URL: http://www.cgsa.net/php/?script=email Sorry, my poooooor academic news server cannot resolve de.comp.lang.php ba.php ufra.lists.php Please forward... -- +------------------------------------------------------------+ | Prof. Ir. Marc W.F. Meurrens phone: +32 (0) 2 537 2812 | http://www.marc.meurrens.org fax: +32 (0) 2 537 7645 | profess: Marc.Meurrens@ACM.org ulb: +32 (0) 2 555 4068 +------------------------------------------------------------+ Darren Casey <darren@php3hosting.com> wrote in message news:nrgslsc10vfd364ct0etqejcf2h4omb0c0@4ax.com... > On Fri, 30 Jun 2000 13:23:37 +0200, "Jose Luis Rodr�guez Sevilla" <joseluis@REMOVEMEferca.com> > wrote: > > >> How i can to validate a domain name that only must contain this characters
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads