The cell phone number attribution query code is a PHP open source phone Attribution query system, the system does not rely on large databases such as MySQL, but rely on text, because, generally a mobile phone number, in the query system, the decision is the first 7 bits
Cell phone number attribution to query code
/*
The cell phone number attribution query code is a PHP tutorial open source Phone Attribution query system, the system does not rely on the MySQL tutorial, such as large database tutorial, but rely on text, because, generally a mobile phone number, in the query system, the decision is the first 7 bits
*/
If ($_post)
{
$phone = (isset ($_post["Phone"]))? $_post["Phone"]:d ie ("please return");
echo "You queried: $phone, Data:". Getphone ($phone);
Function Getphone ($phone) {
$dbpath = "datas/";
$len =strlen ($phone);
if ($len!=11) {
return Mobile phone number only supports 11-bit ";
}
$par = "[0-9]";
for ($i =0; $i < $len; $i + +) {
if (!ereg ($par, substr ($phone, $i, 1)) {
Return] Mobile phone number can only be a number ";
}
}
$sunum =scandir ($dbpath);//Get the supported mobile number prefix
Array_splice ($sunum, 0, 1);//Cancel the current directory
Array_splice ($ sunum,0,1); Remove the top-level directory
$sub =substr ($phone, 0, 3);//Get 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 "temporarily does not support $sub";
}
}
}
?
Cell phone number attribution to query
http://www.bkjia.com/PHPjc/631991.html www.bkjia.com true http://www.bkjia.com/PHPjc/631991.html techarticle the cell phone number attribution query code is a PHP open source phone Attribution query system, the system does not rely on the large database such as MySQL, but rely on text, because, generally a mobile phone number ...