Mobile phone number retrieval code

Source: Internet
Author: User

This mobile phone number attribution query code is a php open-source mobile phone attribution query system, the system does not rely on mysql and other large databases, but rely on text, because, generally, a mobile phone number, the first seven digits play a decisive role in the query system

Mobile phone number retrieval code
/*
This mobile phone number attribution query code is a php tutorial open-source mobile phone attribution query system, the system does not rely on mysql tutorials and other large database tutorials, but rely on text, because, generally, a mobile phone number, the first seven digits play a decisive role in the query system
*/

If ($ _ post)
{
$ Phone = (isset ($ _ post ["phone"])? $ _ Post ["phone"]: die ("Please return ");
Echo "your query: $ phone, Info:". getphone ($ phone );


Function getphone ($ phone ){
$ Dbpath = "datas /";
$ Len = strlen ($ phone );
If ($ len! = 11 ){
Return "only 11 mobile phone numbers are supported ";
}
$ Par = "[0-9]";
For ($ I = 0; $ I <$ len; $ I ++ ){
If (! Ereg ($ par, substr ($ phone, $ I, 1 ))){
Return "the mobile phone number can only be a number ";
}
}
$ Sunum = scandir ($ dbpath); // get the supported mobile phone number prefix
Array_splice ($ sunum,); // cancel the current directory
Array_splice ($ sunum,); // remove the upper-level directory
$ Sub = substr ($ phone,); // obtain the first three digits of the number.
If (in_array ($ sub, $ sunum )){
$ Num = substr ($ phone, 3,4 );
$ Search = file ($ dbpath. $ sub );
$ Result = str_replace ($ num. "=", "", $ search [$ num]); // process data
Return (strlen ($ result)> 1 )? $ Result: "0 ";

} Else {
Return "$ sub" is not supported currently ";
 
}

}
}
?>

<Html>
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8"/>
<Title> mobile phone number attribution query </title>
</Head>
<Body>
<Form action = "search. php" method = "post">
<P> enter the mobile phone number: <input type = "text" name = "phone"> </p>
<P> <input type = "submit" value = "query"> </p>
</Form>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.