Re: Re[2]: [PHP] ICQ # validation
| From: | Leo Spalteholz | Date: | Tue, 04 Mar 2003 03:56:07 +0000 |
| Subject: | Re: Re[2]: [PHP] ICQ # validation | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138027@lists.php.net to get a copy of this message | ||
On March 3, 2003 06:31 pm, Tom Rogers wrote:
> Hi,
>
> Tuesday, March 4, 2003, 12:06:14 PM, you wrote:
> JF> Does it actually NEED a regexp?
>
> JF> UNTESTED code:
> JF> <?
> JF> $icq = 2264532680;
> JF> if( (is_int($icq)) && (strlen($icq) > 7) && (strlen($icq) < 9)
> ) { JF> echo "yah";
> JF> } else {
> JF> echo "nah";
> JF> }
> ?>>
>
> JF> FWIW, Are you SURE that all valid ICQ #'s are between 7 and 9
> chars? JF> Surely at some point they'll reach 10 chars, and *may*
> have started at 6?
>
>
> JF> Justin
>
> JF> on 04/03/03 6:00 AM, Liam Gibbs (liamgibbs@sympatico.ca) wrote:
> >> Maybe I'm off my rocker, but I don't see how this can't work.
> >> I'm trying to validate an ICQ number, and assuming a valid one
> >> is between 7 and 9 numbers. My line of code is this:
> >>
> >> if(ereg("^[0-9]{7,9}$", $_REQUEST["icqnumber"])) {
> >> print("a-okay!");
> >> } else {
> >> print("error msg");
> >> }
> >>
> >> I've submitted the ICQ # 2264532680, but it validates. Any
> >> ideas?
>
> My icq is 6 digits
Would be kinda cool if your scirpt did a search on icq.com and if it
found a result then the ICQ # is valid.. of course that means you're
relying on the icq server to be up and the search page to stay
consistant..
leo