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>